/Routing Tables

Routing Tables

RoutingWhat”s Routing ?

Wether you”re aware of how it works or not,whenever you connect to the internet you”re dealing with routing . Routing simlpy means sending a packet from one point to another until it reaches it”s destination, for examlpe if you send an e-mail to one of your friends it”s -ofcourse- transferred as IP packets , first your system will send these packets to your gateway, your gateway will forward this to another gateway, orВ  a router and so on until it reaches it”s destination.

If you”re running a single computer you”ll never need to worry about routing , afterall all you need is set the IP and gateway supplied by your ISP . However, If you”re on a network it can become abit more complicated as you”re dealing with two networks the local network and the intenet , packets moving from one to another must be routed in a special way to reach their correct destination.
In Unix/Linux Systems this is stored in a kernel structure known as the Routing tables.

To get a clean view of yout Routing table , use :

netstat -r

you should see something similar to this :

Kernel IP routing table

DestinationВ В В В  GatewayВ В В В В В В В В В В В В В  GenmaskВ В В В В В В В В В В В В В  FlagsВ В В  MSSВ В В В В В  WindowВ  irtt

Iface
192.168.1.0В В В В В В  *В В В В В В В В В В В В В  В  В  В  В  В  В В  255.255.255.0В  В В  UВ В В В В В В В В В  0В В В В В В В В В В В В В В В  0В В В В В В В В В  0

eth0
192.168.10.0В В В  *В В В В В В В В В В В В В В В В В В В В В В В В В В В  255.255.255.0В  В  UВ В В В В В В В В В  0В В В В В В В В В В В В В В В  0В В В В В В В В В  0

eth0

defaultВ В В В В В В  В  В  В  В В  192.168.1.1В В В В В В  0.0.0.0В В В В В В В В В В В В В  В  В В  UGВ В В В В В В  0 В  В  В  В  В  В  В В  0В В В В В В В В В  0

blackjack online elskere! Du kan spille opp til fem bokser samtidig og i fullscreen hvis du vil. padding-left: 30px;”> eth0

destination: Shows the target network
Gateway : Shows default gateway an (*) means that there”s no need for a forwarding gateway.
Genmask: Shows the Netmask of this network.
Flags : there are many flags , here (U) shows that the route is up , (G) means that routing is done using a specific
gateway, you”ll see much more flags if your”re using dynamic routing.
Iface : Points to the network inteface used for this network.

MSS: Shows Maximum Segment Size over TCP through this route
Windows : Defines default windows size over this route
irtt : Irtt column indicates the Initial Round Trip Time

the last three are used by the kernel to assign values to TCP parameters without having to wait for the remote host .

Changing the static routes:

now that you know how to view defined routes, all you need is change them , this is said to be done easiest by using linuxconf under redhat -never tried it though- , But let”s stick with the old school method using route command.

To add a new route

route add -net 192.168.1.1 netmask 255.255.0.0 dev eth0
route add default gw
route del -net 192.168.10.0

Manually set up a routing table :

1.Turn on the network interface:

//you can list all avaliable interfaces by typing ifconfig .

sudo ifconfig interface_name up

e.g : sudo ifconfig eth0 up

2.Delete the currnet routes:

ip route list

and it will print all the existing routing table, the next thing to do is delete the existing routing table
ip route del network_

e.g

ip route del 192.168.1.0/24

ip route del default

3. Make new Routing Table.
Add the network:

route add 192.168.1.0/24 dev eth0
If you mean to use your wireless then just replace eth0 with wlan0
Then, add the gateway :

ip route add default via gateway_ip dev interface_name
eg:
ip route add default via 192.168.1.1 dev eth0

and you”re done .
Now give it a thought what would happen if you make the gateway your friend”s ip :)…

//Note:T his is totally safe to try, if you mess things up just run #dhclient .