My Headlines

Monday, March 14, 2011

Pc Router On Ubuntu

As I said above, that here I assume you all have been successfully installed ubuntu 8.04 server version on a computer, then the first step to install the PC router on ubuntu is the Ubuntu updates and upgrades you, this is for all the packages required by ubuntu can be installed updates and upgrades as such, but before the update and upgrade our ubuntu to set ip address from your ISP and LAN as well, the following steps (login as root) :
root@server:~# vim /etc/network/interfaces
 
-- by pressing the letter i add the following line --
## ISP Connection
auto eth0
iface eth0 inet static
address 202.172.16.41
netmask 255.255.255.248
network 202.172.16.39
broadcast 202.172.16.47
gateway 202.172.16.40
## Koneksi to LAN
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
##gateway 192.168.1.1
-- save by pressing :wq and Enter --
If everything is ok, the next step is to make sure that the connection to the internet is ok,
with a step ping yahoo.com and if the reply is the connection to the Internet was ok and continue to update and upgrade ubuntu :
root@server:~# aptitude update && aptitude upgrade
For the next step after the update and upgrade is finished editing the sysctl.conf file:
root@server:~# vim /etc/sysctl.conf
by pressing the letter i find writing #net.ipv4.conf.default.forwarding = 1 and remove the fence that marks the net.ipv4.conf.default.forwarding = 1
save by pressing :wq and Enter
Edit the file ip_forward the valuabe 0 fox into 1 with the following steps:
root@server:~# echo "1" > /proc/sys/net/ipv4/ip_forward
Next we have to make the routing of eth 1 (LAN) to the eth0 (ISP / WAN), it is intended to allow LAN users can communicate with the outside world (the Global Internet), with the command:
root@server:~# /sbin/iptables -t nat -A POSTROUTING -s 192.168.1.0/255.255.255.0 -d 0/0 -j MASQUERADE
Do not forget to save the command script we have made earlier in the rc.local, it is intended that when the computer is restarted the server then automatically orders we have made can be run by the server computer:
root@server:~# Vim /etc/rc.local
-- by pressing the letter i add the following line --
echo "1" > /proc/sys/net/ipv4/ip_forward
/sbin/iptables -t nat -A POSTROUTING -s 192.168.1.0/255.255.255.0 -d
0/0 -j MASQUERADE
Computer server restart:
root@server:~# reboot

references : http://udiniqgeek.com/router_pc.html

No comments: