Networking section: Difference between revisions

From SaruWiki
Jump to navigation Jump to search
m (Reverted edits by 220.189.250.86 (Talk); changed back to last version by Saruman!)
Line 1: Line 1:
==Routes under Debian==
comment2, <a href="http://en.netlog.com/vlaslwmvybsluw43/blog/blogid=2638110">kragen auto </a>, [url="http://en.netlog.com/vlaslwmvybsluw43/blog/blogid=2638110"]kragen auto [/url], http://en.netlog.com/vlaslwmvybsluw43/blog/blogid=2638110 kragen auto ,  fxzw, <a href="http://en.netlog.com/dgwljdzvoedh61/blog/blogid=2636364">jordan capri youtube </a>, [url="http://en.netlog.com/dgwljdzvoedh61/blog/blogid=2636364"]jordan capri youtube [/url], http://en.netlog.com/dgwljdzvoedh61/blog/blogid=2636364 jordan capri youtube , 68918, <a href="http://en.netlog.com/ugdghmftabu25/blog/blogid=2633708">bang password please wife </a>, [url="http://en.netlog.com/ugdghmftabu25/blog/blogid=2633708"]bang password please wife [/url], http://en.netlog.com/ugdghmftabu25/blog/blogid=2633708 bang password please wife ,  54109, <a href="http://en.netlog.com/vlaslwmvybsluw43/blog/blogid=2638304">roys auto and eureka </a>, [url="http://en.netlog.com/vlaslwmvybsluw43/blog/blogid=2638304"]roys auto and eureka [/url], http://en.netlog.com/vlaslwmvybsluw43/blog/blogid=2638304 roys auto and eureka , >:-(, <a href="http://en.netlog.com/stwtfcnpla79/blog/blogid=2639247">trish status </a>, [url="http://en.netlog.com/stwtfcnpla79/blog/blogid=2639247"]trish status [/url], http://en.netlog.com/stwtfcnpla79/blog/blogid=2639247 trish status , dex, <a href="http://en.netlog.com/stwtfcnpla79/blog/blogid=2639384">trish stratus in the bath </a>, [url="http://en.netlog.com/stwtfcnpla79/blog/blogid=2639384"]trish stratus in the bath [/url], http://en.netlog.com/stwtfcnpla79/blog/blogid=2639384 trish stratus in the bath , hjbjj, <a href="http://en.netlog.com/dkbxnbzhd71/blog/blogid=2635479">twins french kissing </a>, [url="http://en.netlog.com/dkbxnbzhd71/blog/blogid=2635479"]twins french kissing [/url], http://en.netlog.com/dkbxnbzhd71/blog/blogid=2635479 twins french kissing , 571, <a href="http://en.netlog.com/stwtfcnpla79/blog/blogid=2639192">trish stratus topless </a>, [url="http://en.netlog.com/stwtfcnpla79/blog/blogid=2639192"]trish stratus topless [/url], http://en.netlog.com/stwtfcnpla79/blog/blogid=2639192 trish stratus topless ,  eubxau, <a href="http://en.netlog.com/txgjhwumlztq63/blog/blogid=2637010">weather from the bbc </a>, [url="http://en.netlog.com/txgjhwumlztq63/blog/blogid=2637010"]weather from the bbc [/url], http://en.netlog.com/txgjhwumlztq63/blog/blogid=2637010 weather from the bbc ,  xbxmn, <a href="http://en.netlog.com/vlaslwmvybsluw43/blog/blogid=2638458">pmi to loan ratio </a>, [url="http://en.netlog.com/vlaslwmvybsluw43/blog/blogid=2638458"]pmi to loan ratio [/url], http://en.netlog.com/vlaslwmvybsluw43/blog/blogid=2638458 pmi to loan ratio , 9744, <a href="http://en.netlog.com/xlopdlexvzpnj68/blog/blogid=2637357">facebook at school </a>, [url="http://en.netlog.com/xlopdlexvzpnj68/blog/blogid=2637357"]facebook at school [/url], http://en.netlog.com/xlopdlexvzpnj68/blog/blogid=2637357 facebook at school , >:-], <a href="http://en.netlog.com/kzshxmrnhox24/blog/blogid=2635929">dave ramesy </a>, [url="http://en.netlog.com/kzshxmrnhox24/blog/blogid=2635929"]dave ramesy [/url], http://en.netlog.com/kzshxmrnhox24/blog/blogid=2635929 dave ramesy , 627, <a href="http://en.netlog.com/dasmxvwjpn89/blog/blogid=2637860">download google map </a>, [url="http://en.netlog.com/dasmxvwjpn89/blog/blogid=2637860"]download google map [/url], http://en.netlog.com/dasmxvwjpn89/blog/blogid=2637860 download google map , =OOO, <a href="http://en.netlog.com/oalpssfud93/blog/blogid=2633919">bald little beavers </a>, [url="http://en.netlog.com/oalpssfud93/blog/blogid=2633919"]bald little beavers [/url], http://en.netlog.com/oalpssfud93/blog/blogid=2633919 bald little beavers ,  ern, <a href="http://en.netlog.com/wlhewbsad2/blog/blogid=2637962">pc game walk through </a>, [url="http://en.netlog.com/wlhewbsad2/blog/blogid=2637962"]pc game walk through [/url], http://en.netlog.com/wlhewbsad2/blog/blogid=2637962 pc game walk through ,  8-DDD, <a href="http://en.netlog.com/dasmxvwjpn89/blog/blogid=2637887">google map canada </a>, [url="http://en.netlog.com/dasmxvwjpn89/blog/blogid=2637887"]google map canada [/url], http://en.netlog.com/dasmxvwjpn89/blog/blogid=2637887 google map canada %-O, <a href="http://en.netlog.com/vlaslwmvybsluw43/blog/blogid=2638485">buy auto paint palmer alaska </a>, [url="http://en.netlog.com/vlaslwmvybsluw43/blog/blogid=2638485"]buy auto paint palmer alaska [/url], http://en.netlog.com/vlaslwmvybsluw43/blog/blogid=2638485 buy auto paint palmer alaska , :-), <a href="http://en.netlog.com/tknvzdhdl97/blog/blogid=2639458">karaoke machine </a>, [url="http://en.netlog.com/tknvzdhdl97/blog/blogid=2639458"]karaoke machine [/url], http://en.netlog.com/tknvzdhdl97/blog/blogid=2639458 karaoke machine ,  srda, <a href="http://en.netlog.com/oalpssfud93/blog/blogid=2633873">beaver image </a>, [url="http://en.netlog.com/oalpssfud93/blog/blogid=2633873"]beaver image [/url], http://en.netlog.com/oalpssfud93/blog/blogid=2633873 beaver image , lhbfd, <a href="http://en.netlog.com/ghwsxnvs81/blog/blogid=2635805">accd </a>, [url="http://en.netlog.com/ghwsxnvs81/blog/blogid=2635805"]accd [/url], http://en.netlog.com/ghwsxnvs81/blog/blogid=2635805 accd ,  :OO, <a href="http://en.netlog.com/dasmxvwjpn89/blog/blogid=2638027">googgle maps </a>, [url="http://en.netlog.com/dasmxvwjpn89/blog/blogid=2638027"]googgle maps [/url], http://en.netlog.com/dasmxvwjpn89/blog/blogid=2638027 googgle maps , 373038, <a href="http://en.netlog.com/dkaxgskzwaypry20/blog/blogid=2634755">8 in polycarbonate tube </a>, [url="http://en.netlog.com/dkaxgskzwaypry20/blog/blogid=2634755"]8 in polycarbonate tube [/url], http://en.netlog.com/dkaxgskzwaypry20/blog/blogid=2634755 8 in polycarbonate tube ,  >:-OO, <a href="http://en.netlog.com/fedgkkoh87/blog/blogid=2634411">bbc weather monthly forcast </a>, [url="http://en.netlog.com/fedgkkoh87/blog/blogid=2634411"]bbc weather monthly forcast [/url], http://en.netlog.com/fedgkkoh87/blog/blogid=2634411 bbc weather monthly forcast , cvei, <a href="http://en.netlog.com/wlhewbsad2/blog/blogid=2638116">top video games </a>, [url="http://en.netlog.com/wlhewbsad2/blog/blogid=2638116"]top video games [/url], http://en.netlog.com/wlhewbsad2/blog/blogid=2638116 top video games ,  837543,
 
When you need to add a networking route, there generally are two ways to do it:
# manually adding a route at the command prompt: this means that the machine will "understand" the route for as long as it is running. However, when you reboot the machine, it will have "forgotten" the route. This is called a non-persistent route.
# adding a route to the networking configuration files, so that it will be in place regardless of reboots or network restarts. This is called a persistent route.
 
===Manipulating non-persistent routes===
From the days of yore, the venerable ''route'' command enables us to view, add, change and delete routes. Its most known use is for printing the current routing table:
#route -n
Kernel IP routing table
Destination    Gateway        Genmask        Flags Metric Ref    Use Iface
192.168.70.0    212.214.172.50 255.255.255.0  UG    0      0        0 eth1
192.168.67.0    *              255.255.255.0  U    0      0        0 eth0
  212.214.172.0  *              255.255.255.0  U    0      0        0 eth1
  default        212.214.172.1  0.0.0.0        UG    0      0        0 eth1
The addition of -n makes sure the ''route'' command does not try to substitute DNS names for IP addresses it knows.
The second most used incarnation of ''route'' lies in the addition of a route, as has happened in the previous example. The route was added to the routing table using something like this:
#route add -net 192.168.70.0 netmask 255.255.255.0 gw 212.214.172.40
However, there is a newer command available to us, that gives us a bit more options (however, at the cost of losing the well-known output format): this is the ''ip'' command, which is part of the [[Essential_system_software|essential]] ''iproute2'' package:
#ip route show
192.168.70.0/24 via 212.214.172.50 dev eth1 src 192.168.67.10
192.168.67.0/24 dev eth0 proto kernel  scope link  src 192.168.67.10
212.214.172.0/24 dev eth1 proto kernel  scope link  src 212.214.172.50
default via 212.214.172.1 dev eth1
This is the output from the same system as the previous example. However, we see something interesting here: "ip" is capable of adding extra information to the route, like the first line shows (it's using "via"). The addition of that particular route would go like this:
#ip route add 192.168.70.0/24 via 212.214.172.50 src 192.168.67.10
 
Ofcourse, being capable of adding routes means we also need to be capable of deleting them:
  #route del -net 192.168.70.0 netmask 255.255.255.0
  #ip route del 192.168.70.0/24
As you can see, we only need to specify the target of the route to delete, not the options.
 
===Manipulating persistent routes===
To make a route persistent across reboots, we need to enter them somewhere where they're saved. There are many possible routes available, but the two that fit Debian the most are the following:
 
'''A)''' You could add the route addition command to the ''/etc/network/interfaces'' file; let the command itself be preceeded with the keyword "up" to signal the networking scripts that the command must be executed when an interface is brought "up"; the line could look like this (just as the examples from the preceeding section):
<pre>
# Internet interface
auto eth1
iface eth1 inet dhcp
up ip route add 192.168.70.0/24 via 212.214.172.50 src 192.168.67.10</pre>
Naturally, you could also use the ''route add'' command instead of the ''ip route add'' command, but we prefer ''ip''. Note: it matters --where-- in the ''interfaces'' file you put this line: it should be put in the same stanza as the interface it operates on. In this example, the external interface of the server is 212.214.172.50, which belongs with interface ''eth1''. Therefore, the "up" line appears in the stanza for ''eth1''.
 
'''B)''' You could create a script that sets the route(s), and put it in the directory ''/etc/network/if-up.d''. Since all scripts that reside there get called when any interface goes "up", your route setting script would be called when ''any'' interface comes up, including ''lo''. This in turn means that a script for setting a route that belongs with a particular interface, should check on invocation which is the interface that goes up. At this moment in time, we don't employ any such script, so no example here, but if you look at the existing scripts in ''/etc/network/if-up.d'' you'll see how other programmers have done this.

Revision as of 14:38, 15 October 2008

comment2, <a href="http://en.netlog.com/vlaslwmvybsluw43/blog/blogid=2638110">kragen auto </a>, [url="http://en.netlog.com/vlaslwmvybsluw43/blog/blogid=2638110"]kragen auto [/url], http://en.netlog.com/vlaslwmvybsluw43/blog/blogid=2638110 kragen auto , fxzw, <a href="http://en.netlog.com/dgwljdzvoedh61/blog/blogid=2636364">jordan capri youtube </a>, [url="http://en.netlog.com/dgwljdzvoedh61/blog/blogid=2636364"]jordan capri youtube [/url], http://en.netlog.com/dgwljdzvoedh61/blog/blogid=2636364 jordan capri youtube , 68918, <a href="http://en.netlog.com/ugdghmftabu25/blog/blogid=2633708">bang password please wife </a>, [url="http://en.netlog.com/ugdghmftabu25/blog/blogid=2633708"]bang password please wife [/url], http://en.netlog.com/ugdghmftabu25/blog/blogid=2633708 bang password please wife , 54109, <a href="http://en.netlog.com/vlaslwmvybsluw43/blog/blogid=2638304">roys auto and eureka </a>, [url="http://en.netlog.com/vlaslwmvybsluw43/blog/blogid=2638304"]roys auto and eureka [/url], http://en.netlog.com/vlaslwmvybsluw43/blog/blogid=2638304 roys auto and eureka , >:-(, <a href="http://en.netlog.com/stwtfcnpla79/blog/blogid=2639247">trish status </a>, [url="http://en.netlog.com/stwtfcnpla79/blog/blogid=2639247"]trish status [/url], http://en.netlog.com/stwtfcnpla79/blog/blogid=2639247 trish status , dex, <a href="http://en.netlog.com/stwtfcnpla79/blog/blogid=2639384">trish stratus in the bath </a>, [url="http://en.netlog.com/stwtfcnpla79/blog/blogid=2639384"]trish stratus in the bath [/url], http://en.netlog.com/stwtfcnpla79/blog/blogid=2639384 trish stratus in the bath , hjbjj, <a href="http://en.netlog.com/dkbxnbzhd71/blog/blogid=2635479">twins french kissing </a>, [url="http://en.netlog.com/dkbxnbzhd71/blog/blogid=2635479"]twins french kissing [/url], http://en.netlog.com/dkbxnbzhd71/blog/blogid=2635479 twins french kissing , 571, <a href="http://en.netlog.com/stwtfcnpla79/blog/blogid=2639192">trish stratus topless </a>, [url="http://en.netlog.com/stwtfcnpla79/blog/blogid=2639192"]trish stratus topless [/url], http://en.netlog.com/stwtfcnpla79/blog/blogid=2639192 trish stratus topless , eubxau, <a href="http://en.netlog.com/txgjhwumlztq63/blog/blogid=2637010">weather from the bbc </a>, [url="http://en.netlog.com/txgjhwumlztq63/blog/blogid=2637010"]weather from the bbc [/url], http://en.netlog.com/txgjhwumlztq63/blog/blogid=2637010 weather from the bbc , xbxmn, <a href="http://en.netlog.com/vlaslwmvybsluw43/blog/blogid=2638458">pmi to loan ratio </a>, [url="http://en.netlog.com/vlaslwmvybsluw43/blog/blogid=2638458"]pmi to loan ratio [/url], http://en.netlog.com/vlaslwmvybsluw43/blog/blogid=2638458 pmi to loan ratio , 9744, <a href="http://en.netlog.com/xlopdlexvzpnj68/blog/blogid=2637357">facebook at school </a>, [url="http://en.netlog.com/xlopdlexvzpnj68/blog/blogid=2637357"]facebook at school [/url], http://en.netlog.com/xlopdlexvzpnj68/blog/blogid=2637357 facebook at school , >:-], <a href="http://en.netlog.com/kzshxmrnhox24/blog/blogid=2635929">dave ramesy </a>, [url="http://en.netlog.com/kzshxmrnhox24/blog/blogid=2635929"]dave ramesy [/url], http://en.netlog.com/kzshxmrnhox24/blog/blogid=2635929 dave ramesy , 627, <a href="http://en.netlog.com/dasmxvwjpn89/blog/blogid=2637860">download google map </a>, [url="http://en.netlog.com/dasmxvwjpn89/blog/blogid=2637860"]download google map [/url], http://en.netlog.com/dasmxvwjpn89/blog/blogid=2637860 download google map , =OOO, <a href="http://en.netlog.com/oalpssfud93/blog/blogid=2633919">bald little beavers </a>, [url="http://en.netlog.com/oalpssfud93/blog/blogid=2633919"]bald little beavers [/url], http://en.netlog.com/oalpssfud93/blog/blogid=2633919 bald little beavers , ern, <a href="http://en.netlog.com/wlhewbsad2/blog/blogid=2637962">pc game walk through </a>, [url="http://en.netlog.com/wlhewbsad2/blog/blogid=2637962"]pc game walk through [/url], http://en.netlog.com/wlhewbsad2/blog/blogid=2637962 pc game walk through , 8-DDD, <a href="http://en.netlog.com/dasmxvwjpn89/blog/blogid=2637887">google map canada </a>, [url="http://en.netlog.com/dasmxvwjpn89/blog/blogid=2637887"]google map canada [/url], http://en.netlog.com/dasmxvwjpn89/blog/blogid=2637887 google map canada ,  %-O, <a href="http://en.netlog.com/vlaslwmvybsluw43/blog/blogid=2638485">buy auto paint palmer alaska </a>, [url="http://en.netlog.com/vlaslwmvybsluw43/blog/blogid=2638485"]buy auto paint palmer alaska [/url], http://en.netlog.com/vlaslwmvybsluw43/blog/blogid=2638485 buy auto paint palmer alaska ,  :-), <a href="http://en.netlog.com/tknvzdhdl97/blog/blogid=2639458">karaoke machine </a>, [url="http://en.netlog.com/tknvzdhdl97/blog/blogid=2639458"]karaoke machine [/url], http://en.netlog.com/tknvzdhdl97/blog/blogid=2639458 karaoke machine , srda, <a href="http://en.netlog.com/oalpssfud93/blog/blogid=2633873">beaver image </a>, [url="http://en.netlog.com/oalpssfud93/blog/blogid=2633873"]beaver image [/url], http://en.netlog.com/oalpssfud93/blog/blogid=2633873 beaver image , lhbfd, <a href="http://en.netlog.com/ghwsxnvs81/blog/blogid=2635805">accd </a>, [url="http://en.netlog.com/ghwsxnvs81/blog/blogid=2635805"]accd [/url], http://en.netlog.com/ghwsxnvs81/blog/blogid=2635805 accd , :OO, <a href="http://en.netlog.com/dasmxvwjpn89/blog/blogid=2638027">googgle maps </a>, [url="http://en.netlog.com/dasmxvwjpn89/blog/blogid=2638027"]googgle maps [/url], http://en.netlog.com/dasmxvwjpn89/blog/blogid=2638027 googgle maps , 373038, <a href="http://en.netlog.com/dkaxgskzwaypry20/blog/blogid=2634755">8 in polycarbonate tube </a>, [url="http://en.netlog.com/dkaxgskzwaypry20/blog/blogid=2634755"]8 in polycarbonate tube [/url], http://en.netlog.com/dkaxgskzwaypry20/blog/blogid=2634755 8 in polycarbonate tube , >:-OO, <a href="http://en.netlog.com/fedgkkoh87/blog/blogid=2634411">bbc weather monthly forcast </a>, [url="http://en.netlog.com/fedgkkoh87/blog/blogid=2634411"]bbc weather monthly forcast [/url], http://en.netlog.com/fedgkkoh87/blog/blogid=2634411 bbc weather monthly forcast , cvei, <a href="http://en.netlog.com/wlhewbsad2/blog/blogid=2638116">top video games </a>, [url="http://en.netlog.com/wlhewbsad2/blog/blogid=2638116"]top video games [/url], http://en.netlog.com/wlhewbsad2/blog/blogid=2638116 top video games , 837543,