≡ Menu

Ubuntu as a Network Router Configuration

1. first you must login to the system, use the user and password that you created when the process was installed

2. now you have entered as a regular user, to be able to do the configuration you have to login as root, since for him the root password has not been there you can make your username as root

sudo su

enter your password, and you have to become root! congratulations!

but wait a minute because you do not have the root password you must create a password

passwd root

enter your desired root password twice

after that so deh, his root password,

3. edit Ethernet configuration with the command

nano /etc/network/interfaces

edit this post as needed, [optional]

auto eth0
IFACE eth0 inet static
address 192.168.168.1
netmask 255.255.255.0
network 192.168.168.0
Broadcast 192 168 168 255

auto eth1
IFACE eth1 inet static
address 192.168.1.1
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255

edit data as needed

save by pressing ctrl + x then press y and enter

4. after that we enter the dns address [different every ISP]
by typing the command

nano /etc/resolv.conf

contents of its files about something like this

nameserver 202.155.0.15
nameserver 122.109.0.74

the parable dns1 and dns2 if agan have 4 dns servers paste aja ya live under it again.

save by pressing ctrl + x then press y and enter

5. so that setting of the function used to restart its service network

/etc/init.d/networking restart

6. ubuntu server so that it can do routing, there is one configuration that must be edited, namely:

nano /etc/sysctl.conf

search in the following:

# Net.ipv4.conf.default.forwarding = 1

fence uncheck it so:

net.ipv4.conf.default.forwarding = 1

save and exit with the command:
ctrl + x, type y and press enter

make sure the number after the equals sign “=” is 1It means that
1. means the kernel is allowed to routing
0. kernel can not do the routing process

7. routing script
after that, you still have to make / insert script for routing
so that the PC would know where in the routing network

type the following command [change as needed]

/sbin/iptables-t nat-A POSTROUTING-s 192.168.168.0/255.255.255.0-d 0 / 0-j MASQUERADE

His explanation like this:
-T nat= Is the manufacture of nat table in iptables
-A POSTROUTING= This will add a new rule in the POSTROUTING
-S 192.168.168.0/255.255.255.0= The ip address in the routing client that will be between 0-255. can also be written 192.168.168.0/24
-D 0/0 = This section will seek out the source package. command 0 / 0 means it will search in global form.
-J MASQUERADE= This command will direct the chain gets a certain package, but without source.

completed, but wait a minute, the configuration using iptables just now is only temporary, so if the server on reboot the pc, its settings will be lost

well

so that the configuration is always done from the start pc in turn

paste the script had to file /etc/rc.local

nano /etc/rc.local

input the following command at the bottom section rc.local

{ 0 comments… add one }

Leave a Comment

*