Multiple IP addresses on one NIC and Multiple internet connections on one nic: Difference between revisions
No edit summary |
No edit summary |
||
Line 7: | Line 7: | ||
net eth0 82.94.91.79,188.204.140.224 routeback | net eth0 82.94.91.79,188.204.140.224 routeback | ||
</pre> | </pre> | ||
/etc/iproute2/rt_tables | |||
<pre> | <pre> | ||
# | # | ||
# reserved values | # reserved values | ||
Line 23: | Line 24: | ||
82 sdsl | 82 sdsl | ||
188 fibre | 188 fibre | ||
</pre> | |||
<pre> | |||
ip route add 82.94.91.64/28 dev eth0 src 82.94.91.77 table sdsl | 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 route add default via 82.94.91.65 table sdsl | ||
Line 64: | Line 66: | ||
post-down ip addr del 188.204.140.196 dev eth0:1 | post-down ip addr del 188.204.140.196 dev eth0:1 | ||
</pre> | </pre> | ||
To change the default gateway the server and programmes launched from it use, you may have to delete the old gateway (it'll only accept one) with | |||
ip route del default via 82.94.91.65 | |||
and add the new one with | |||
ip route add default via 188.204.140.193 | |||
More information: | More information: |
Revision as of 14:17, 4 August 2010
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/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 route add default via 188.204.140.193 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
To change the default gateway the server and programmes launched from it use, you may have to delete the old gateway (it'll only accept one) with
ip route del default via 82.94.91.65
and add the new one with
ip route add default via 188.204.140.193
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