Multiple IP addresses on one NIC and Multiple internet connections on one nic

From Edgar BV Wiki
Revision as of 14:07, 4 August 2010 by 192.168.0.39 (talk)
Jump to navigation Jump to search

isp isps nic ip alias ip aliasing multiple ips on one nic

Multiple Connections to the Internet / two isps on one nic

/etc/shorewall/interfaces

net     eth0    82.94.91.79,188.204.140.224 routeback
/etc/iproute2# cat rt_tables
#
# reserved values
#
255     local
254     main
253     default
0       unspec
#
# local
#
#1      inr.ruhep
82 sdsl
188 fibre


ip route add 82.94.91.64/28 dev eth0 src 82.94.91.77 table sdsl
ip route add default via 82.94.91.65 table sdsl
ip rule add from 82.94.91.64/28 table sdsl

ip route add 188.204.140.192/27 dev eth0 src 188.204.140.196 table fibre
ip route add default via 188.204.140.193 table fibre
ip rule add from 188.204.140.192/27 table fibre

to check:
ip rule show
ip route list table fibre
ip route list table sdsl

or in /etc/network/interfaces

auto eth0
iface eth0 inet static
        address 82.94.91.77
        netmask 255.255.255.240
        #netmask 255.255.255.255
        network 82.94.91.64
        broadcast 82.94.91.79
        gateway 82.94.91.65
        dns-nameservers 213.75.63.36 194.109.9.99 212.61.33.42 194.109.6.66
        post-up ip route add 82.94.91.64/28 dev eth0 src 82.94.91.77 table sdsl
        post-up ip route add default via 82.94.91.65 table sdsl
        post-up ip rule add from 82.94.91.64/28 table sdsl
        post-down ip rule del from 82.94.91.64/28 table sdsl

        post-up ip addr add 188.204.140.196/27 brd 188.204.140.223 dev eth0:1 label eth0:1
        post-up ip route add 188.204.140.192/27 dev eth0 src 188.204.140.196 table fibre
        post-up ip rule add from 188.204.140.192/27 table fibre
        post-down ip rule del from 188.204.140.192/27 table fibre
        post-down ip addr del 188.204.140.196 dev eth0:1

More information:

http://linux-ip.net/html/adv-multi-internet.html#ex-adv-multi-internet-outbound-ip-routing

http://www.policyrouting.org/iproute2.doc.html#ss9.5


ip address management with ip addr - http://linux-ip.net/html/tools-ip-address.html#tb-tools-ip-addr-scope


ip addr add 188.204.140.195/27 brd 188.204.140.223 dev eth1 label eth1:1


A lot on policy routing - http://www.policyrouting.org/iproute2.doc.html#ss9.5


ip link list - shows the physical devices

ip addr list - shows the adressees the links have

ip addr show dev eth0


Basic ip route - http://linux-ip.net/html/tools-ip-route.html

ip route list - like netstat -rn

/etc/iproute2/rt_tables - contains the routing tables

ip route show table local / main - shows the specified table

ip -s route show cache

ip route flush cache

NB - ip route flush kills all the routing tables!!!


More on routing tables - http://linux-ip.net/html/routing-tables.html

eth0 82.94.91.77

eth0:0 188.204.140.196/27