LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   basic routing commands (https://www.linuxquestions.org/questions/linux-networking-3/basic-routing-commands-936048/)

alftavay 03-23-2012 10:01 AM

basic routing commands
 
Hi everybody

My route -n and ifconfig look like this right now. Letter characters in place of numeric digits below are for privacy.

$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.11.ac.0 0.0.0.0 255.255.252.0 U 1 0 0 eth0
1de.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 eth0
0.0.0.0 10.11.ab.254 0.0.0.0 UG 0 0 0 eth0

ifconfig eth0
eth0 Link encap:Ethernet HWaddr ...
inet addr:10.11.72.68 Bcast:10.11.ab.255 Mask:255.255.252.0

What commands can i enter to make a route to host 192.168.fef.ghi?

Thanks ...

nikmit 03-23-2012 10:08 AM

ip route add x.x.x.x via y.y.y.y
or
ip route add x.x.x.a/bb via y.y.y.y, where 'a' is the subnet address and 'bb' the prefix length - most commonly equal to '0/24'

you might also have to do 'ip route flush cache' after adding the route to activate it.

alftavay 03-23-2012 10:47 AM

Thanks. So in my case it would be
ip route add 192.168.fef.ghi via y.y.y.y
or
ip route add 192.168.fef.0/24 via y.y.y.y
But how do i figure out y.y.y.y? ...

acid_kewpie 03-23-2012 10:51 AM

you don't "figure it out", you either know, or you ask someone who knows your network better than you do. It's an arbitrary device on YOUR network, so we can't tell you that.


All times are GMT -5. The time now is 12:02 PM.