Linux as Router
Topologi jaringan :
Router_1 mempunyai IP eth0 100.100.100.1/24, eth1 10.10.10.1/24
Router_2 mempunyai IP eth0 100.100.100.2/24, eth1 10.10.20.1/24
Router_3 mempunyai IP eth0 100.100.100.3/24, eth1 10.10.30.1/24
LAN_1 mempunyai jaringan 10.10.10.0/24
LAN_2 mempunyai jaringan 10.10.20.0/24
LAN_3 mempunyai jaringan 10.10.30.0/24
• Setting Router_1
# vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=router1
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=static
IPADDR=100.100.100.1
NETMASK=255.255.255.0
ONBOOT=yes
USERCTL=no
# vi /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
BOOTPROTO=static
IPADDR=10.10.10.1
NETMASK=255.255.255.0
ONBOOT=yes
USERCTL=no
Setting ip_forwarding
# vi /etc/sysctl.conf
ubah net.ipv4.ip_forward = 0 menjadi net.ipv4.ip_forward = 1
restart network
# /etc/init.d/network restart
Tambahkan sintak route
# route add –net 10.10.0.0 netmask 255.255.0.0 gw 10.10.10.1
Supaya pada waktu sistem booting dapat dijalankan otomatis tambahkan pada /etc/rc.local
# vi /etc/rc.local
route add –net 10.10.0.0 netmask 255.255.0.0 gw 10.10.10.1
• Setting Router_2
# vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=router2
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=static
IPADDR=100.100.100.2
NETMASK=255.255.255.0
ONBOOT=yes
USERCTL=no
# vi /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
BOOTPROTO=static
IPADDR=10.10.20.1
NETMASK=255.255.255.0
ONBOOT=yes
USERCTL=no
Setting ip_forwarding
# vi /etc/sysctl.conf
ubah net.ipv4.ip_forward = 0 menjadi net.ipv4.ip_forward = 1
restart network
# /etc/init.d/network restart
Tambahkan sintak route
# route add –net 10.10.0.0 netmask 255.255.0.0 gw 10.10.20.1
Supaya pada waktu sistem booting dapat dijalankan otomatis tambahkan pada /etc/rc.local
# vi /etc/rc.local
route add –net 10.10.0.0 netmask 255.255.0.0 gw 10.10.20.1
• Setting Router_3
# vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=router3
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=static
IPADDR=100.100.100.3
NETMASK=255.255.255.0
ONBOOT=yes
USERCTL=no
# vi /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
BOOTPROTO=static
IPADDR=10.10.30.1
NETMASK=255.255.255.0
ONBOOT=yes
USERCTL=no
Setting ip_forwarding
# vi /etc/sysctl.conf
ubah net.ipv4.ip_forward = 0 menjadi net.ipv4.ip_forward = 1
restart network
# /etc/init.d/network restart
Tambahkan sintak route
# route add –net 10.10.0.0 netmask 255.255.0.0 gw 10.10.30.1
Supaya pada waktu sistem booting dapat dijalankan otomatis tambahkan pada /etc/rc.local
# vi /etc/rc.local
route add –net 10.10.0.0 netmask 255.255.0.0 gw 10.10.30.1