Halaman

Tampilkan postingan dengan label Routing. Tampilkan semua postingan
Tampilkan postingan dengan label Routing. Tampilkan semua postingan

Jumat, 14 Maret 2014

Routing on Linux

First we have to enable port forwarding

root@server1:~# apt-get install iproute

root@server1:~# vim /etc/sysctl.conf
net.ipv4.ip_forward=1

root@server1:~# sysctl -p 
net.ipv4.ip_forward=1

Now, we will add ip address and a static route.  
root@server1:~# vim /etc/network/interfaces 
# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
allow-hotplug eth0
iface eth0 inet static
        address 202.94.76.71
        netmask 255.255.252.0

auto eth1
allow-hotplug eth1
iface eth0 inet static
        address 172.16.0.254
        netmask 255.255.0.0

auto eth2
allow-hotplug eth2
iface eth2 inet static
        address 192.168.1.1
        netmask 255.255.255.0

### add default gateway
up route add default gw 202.94.76.65

### ip route add (remote_network) via (remote_connecting_gatway) dev (local_outgoing_interface)
up ip route add 192.168.55.0/24 via 192.168.1.254  dev eth1
down ip route del 192.168.55.0/24 via 192.168.1.254  dev eth1

root@server1:~# /etc/init.d/networking restart