setup static route for a hostname

Laszlo Beres laszlo at beres.me
Mon Feb 22 22:12:02 UTC 2010


On Mon, Feb 22, 2010 at 10:54 PM, Charan <charan314 at gmail.com> wrote:

> We usually setup static routes using IP where this IP is destination IP. Can
> we also give the destination hostname while configuring route?

Of course:

[root at nb287 ~]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     0.0.0.0         255.255.255.0   U     2      0        0 wlan0
192.168.122.0   0.0.0.0         255.255.255.0   U     0      0        0 virbr0
0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 wlan0
[root at nb287 ~]# route del default
[root at nb287 ~]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     0.0.0.0         255.255.255.0   U     2      0        0 wlan0
192.168.122.0   0.0.0.0         255.255.255.0   U     0      0        0 virbr0
[root at nb287 ~]# route add default gw wlan-gateway
[root at nb287 ~]# grep wlan-gateway /etc/hosts
192.168.1.1	wlan-gateway
[root at nb287 ~]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     0.0.0.0         255.255.255.0   U     2      0        0 wlan0
192.168.122.0   0.0.0.0         255.255.255.0   U     0      0        0 virbr0
0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 wlan0

-- 
László Béres            Unix system engineer
http://www.google.com/profiles/beres.laszlo




More information about the redhat-list mailing list