Open ping in server from one IP
Good Night,
If you want to enable PING in your SERVER just from ONE IP use this IPtables rule:
$ sudo iptables -A INPUT -p icmp -s 150.162.60.37 -j ACCEPT
Best Regards,
Matheus
Good Night,
If you want to enable PING in your SERVER just from ONE IP use this IPtables rule:
$ sudo iptables -A INPUT -p icmp -s 150.162.60.37 -j ACCEPT
Best Regards,
Matheus
Good night,
If you want to install DHCP server in Ubuntu, use
$ sudo apt-get install dhcp3-server
And then edit /etc/dhcp3/dhcpd.conf I commented all lines and add this ones:
INTERFACES=”eth1″; # INTERFACE CONECATADA AO MEU ROTEADOR
ddns-update-style none;
default-lease-time 600;
max-lease-time 7200;
authoritative; # DHCP PRINCIPAL DA REDEsubnet 192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.100 192.168.0.150; # FAIXA DE IPS A SER DISTRIBUIDA
option routers 192.168.0.254; # GATEWAY
option domain-name-servers 200.247.141.11; # SERVIDOR DNS
option subnet-mask 255.255.255.0; # MASCARA DE SUBREDE
option broadcast-address 192.168.0.255; # ENDEREÇO DE BROADCAST
default-lease-time 600;
max-lease-time 7200;
}
Restart eh DHCP server:
$ sudo /etc/init.d/dhcp3-server restart
See you,
Matheus
Reference:
Google + DHCP SERVER UBUNTU
Hello,
The last days I keep trying to configure my server. I know how to configure the network to this:
MODEM -> (eth0) Servidor (eth1) -> (LAN Port) Router (LAN Ports) -> Computers
This topology don`t work for me, because in this way I lost one WAN Port. So I thought in this topology:
MODEM -> (eth0) Servidor (eth1) -> (Porta WAN) Router (Portas LAN) -> Computadores
First of all configure your eth1 manyally as (edit /etc/network/interfaces):
auto eth1
iface eth1 inet static
address 192.168.100.254
netmask 255.255.255.0
network 192.168.100.0
broadcast 192.168.100.255After this I add this iptables rules:
sysctl net.ipv4.ip_forward=1
iptables -t nat -A POSTROUTING –out-interface eth0 -j MASQUERADE
iptables -A FORWARD –in-interface eth0 -j ACCEPTI need to setup the router manually:
IP Address : 192.168.100.1
Subnet Mask : 255.255.255.0
ISP Gateway Address : 192.168.100.254
Primary DNS Address : 200.247.141.11 (DNS)
Secondary DNS Address : 200.247.141.12 (DNS)So up and running
Matheus
Hello,
Today I will just recomment to you the post of Juliano Martins about how o install Ubuntu from pendrive.
UPDATE: In the last days I tried the tool from Ubuntu (USB Startup Disk Creaator) and it works!
Best Regards,
Matheus
Good night,
To install ssh server in Ubuntu use:
$ sudo apt-get install openssh-server
To let it safer edit /etc/ssh/sshd_config
$ sudo vi /etc/ssh/sshd_config
Than change the lines:
AllowUsers USER
AllowGroups GROUP_USER
PasswordAuthentication yes
MaxStartups 2:100:2
Port XXX # Change the port
What MaxStartups do? Specify the number of un authenticated connections in server. The syntax is start:percent:max. Example: 10:50:20. When it gets to 10 connections it will start with the percent. So every new connection will have 50% of chance to be automaticlly refused. When it gets to 20. It will denied ALL the new connections.
If you want, you can ask for a second password, if you type it wrong, it will close the connection:
Edit /home/user/.profile
echo Put your password
read senha
if [ $senha == "SOMETHING" ]
then
# CODES THAT ALREADY ARE AT .profile
else
exit
fi
With this you can do some tricks, to create a new RANDOM password every time somebody connect and send it to your e-mail. So you will need to put your normal password, than access your e-mail account, verify the new password and type it.
Best Regards,
Matheus
References:
Desabilitar Comando SU
Informação MaxStartups
Good Night,
This is a simple tip, how to execute some file in computer startup. (I used this tip to enable the port forward on startup)
Copy your file to /etc/init.d/ using “cp file /etc/init.d/file”
Edit /etc/rc.local (as root) and add the file that you want to execute. You must use the full path like /etc/init.d/file.sh for example.
The file must have execution permissions, do this using “chmod +x /etc/init.d/file.sh”
Matheus
PS: You must add the line before “exit 0″ in rc.local
Good afternoon,
If you want to forward ports to a virtualmachine in VirtualBox you should do this:
Create an interface “tap”
#sudo tunctl -u $USER
Set the tap address:
#sudo ip addr add 192.168.0.20/32 dev tap0
# sudo ip link set tap0 up
Enable Ip Forward
# sudo sysctl net.ipv4.ip_forward=1
Add route:
#sudo route add -host 192.168.0.150 dev tap0
Create nat:
# sudo iptables –flush
#sudo iptables -t nat –flush
#sudo iptables -t nat -A POSTROUTING –out-interface eth1 -j MASQUERADE
#sudo iptables -A FORWARD –in-interface eth1 -j ACCEPT
Redirecting port 3333 to 3389:
#iptables -t nat -A PREROUTING -i eth1 -p tcp -d 192.168.0.100 –dport 3333 -j DNAT –to 192.168.0.150:3389
eth1 – Ethernet connected to the router.
192.168.0.150 – IP of virtualmachine
192.168.0.20 – IP of tap
192.168.0.100 – IP of my real machine that receive the connections in 3333
After this configure manually your virtualmachine to:
IP: 192.168.0.150
Subnet Mask: 255.255.255.0
Default Gateway: 192.168.0.100
I had problems with ‘–’ so here is a file with the commands: Forward ports to a virtualmachine.
Hope this is usefull,
Matheus
References:
IPtables Tutorial
IPTables Port Redirect
VirtualBox, com nat
VBoxManage Port Forward
Hey,
Just a fast tip, if you want to have a ssh server more secure disable root access in “/etc/ssh/sshd_config”
Find the line starting with PermitRootLogin and set it to nojust like this:
PermitRootLogin no.
I already setup my ubuntu server, and have infos about ssh and other configurations. I’m translating the old articles to english first, so don’t get angry if I take a little time to post it. I hope in the next month the portuguese version and the english, start to run together
Bye,
Matheus
Hello,
A week ago I was thinking about banks autentications, here in Brazil, you have to register your computer to get access to the bank site with your computer. Do this every time you format your hard disk is sux, so i thought, why don’t use a virtual machine with a Damn Small linux and use it to access? It’s a good idea.
I created my virtual machine with virtualbox and downloaded the last version of Damn Small Linux. I started the virtualmachine and i saw it was running from cd. Searching around the internet i discovered it is dedicated to live-cd but you can install it if you want to. In portuguese version I translated this article about how to install damn small linux but in english i don’t have to.
So this is just a tip, if you have to register your computer to do some things, why don’t you install a Damn small linux and use it for this? Other advantage is that you can take it with you, and linux don’t have virus so you don’t have to worry about this kind of security
If you want to install Java to firefox follow this article.
If your mouse don’t work use “xsetup.sh” and choose a mouse that isn’t USB. It works for me, now i have my USB mouse working. (I think it’s something about Virtualmachin)
Matheus
Hello,
I was using NetBeans in Ubuntu 9.04 when i started a new project and I realized that the line-spacing is so fucking bigger. To fix this you have to do this:
Edit the file “org-netbeans-modules-editor-settings-CustomPreferences.xml”
$ pico org-netbeans-modules-editor-settings-CustomPreferences.xml
This file will be in:
/home/user/.netbeans/6.5/config/Editors/Preferences
If the file and the directory exists just add the following lines:
<entry javaType=”java.lang.Float” name=”line-height-correction”
xml:space=”preserve”>
<value><![CDATA[0.75]]></value>
</entry>
If don’t you have to create the directory “Preferences”:
$ mkdir Preferences
(In /home/user/.netbeans/6.5/config/Editors)
$ cd Preferences
And create the file:
$ pico org-netbeans-modules-editor-settings-CustomPreferences.xml
Add the following lines:
<?xml version=”1.0″ encoding=”UTF-8″?>
<!DOCTYPE editor-preferences PUBLIC “-//NetBeans//DTD Editor Preferences 1.0//EN” “http://www.netbeans.org/dtds/EditorPreferences-1_0.dtd”>
<editor-preferences>
<entry javaType=”java.lang.String” name=”code-template-expand-key” xml:space=”preserve”>
<value><![CDATA[TAB]]></value>
</entry>
<entry javaType=”java.lang.Float” name=”line-height-correction” xml:space=”preserve”>
<value><![CDATA[0.75]]></value>
</entry>
</editor-preferences>
Save, restart netbeans and enjoy it.
Good Night,
Matheus
References:
http://my.opera.com/Nobita2708/blog/show.dml/2914020
http://www.linux4all.net/how_to_change_line_height_in_netbeans_editor
http://www.cs.wcupa.edu/rkline/netbeans-lin.html
http://www.google.com.br/search?hl=pt-BR&q=line+spacing+ubuntu+netbeans&btnG=Pesquisar&meta=