Friday, March 7, 2008

Linux Router Config.

Sample:

[aslam@localhost ~]$ su
password:
[root@localhost aslam]# /etc/init.d/network restart
........................................[OK]
........................................[OK]
........................................[OK]
........................................[OK]
[root@localhost aslam]# /sbin/ifconfig eth0 192.168.1.1 netmask 255.255.255.0 broadcast 192.168.1.255
[root@localhost aslam]# /sbin/route add -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.1.1 dev eth0
[root@localhost aslam]# /sbin/ifconfig eth1 192.168.2.1 netmask 255.255.255.0 broadcast 192.168.2.255
[root@localhost aslam]# /sbin/route add -net 192.168.2.0 netmask 255.255.255.0 gw 192.168.2.1 dev eth1
[root@localhost aslam]# echo 1 /proc/sys/net/ipv4/ip_forward
[root@localhost aslam]# cat /proc/sys/net/ipv4/ip_forward
[root@localhost aslam]# echo 1 /proc/sys/net/ipv4/ip_forward

PENERANGAN

/etc/init.d/network restart - up network card
sbin/ifconfig eth0 192.168.1.1 netmask 255.255.255.0 broadcast 192.168.1.255 - set ip
/sbin/route add -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.1.1 dev eth0 - set gateway
echo 1 /proc/sys/net/ipv4/ip_forward - set ip forwading (nak bg bole berkomunikasi)
cat /proc/sys/net/ipv4/ip_forward - check status echo (sama run = 1 atau x run = 0)
*klu x run, buat echo sekali lg

pc - pc x bole nak ping kerana:
  • firewall pc x off
  • antivirus x off
  • firewall router (linux) x off
  • ip forwarding - tiap kali restart network card - x upkan

No comments: