Bringing up an Ethernet interface with ifconfig
[root@morgan]# ifconfig eth0 192.168.99.14 netmask 255.255.255.0
|
ifconfig and route output before the change
[root@morgan]# ifconfig eth0 eth0Link encap:EthernetHWaddr 00:80:C8:F8:4A:53inet addr:192.168.98.82Bcast:192.168.98.255Mask:255.255.255.0UP BROADCAST RUNNING MULTICASTMTU:1500Metric:1RX packets:0 errors:0 dropped:0 overruns:0 frame:0TX packets:0 errors:0 dropped:0 overruns:0 carrier:0collisions:0 txqueuelen:100 RX bytes:0 (0.0 b)TX bytes:0 (0.0 b)Interrupt:9 Base address:0x5000 [root@morgan]# route -n Kernel IP routing tableDestination Gateway Genmask Flags Metric RefUse Iface192.168.98.00.0.0.0 255.255.255.0 U 000 eth0127.0.0.0 0.0.0.0 255.0.0.0 U 000 lo0.0.0.0 192.168.98.2540.0.0.0 UG000 eth0
|
Adding a default route with route
[root@morgan]# route -n Kernel IP routing tableDestination Gateway Genmask Flags Metric RefUse Iface192.168.99.00.0.0.0 255.255.255.0 U 000 eth0127.0.0.0 0.0.0.0 255.0.0.0 U 000 lo [root@morgan]# route add default gw 192.168.99.254 [root@morgan]# route -n Kernel IP routing tableDestination Gateway Genmask Flags Metric RefUse Iface192.168.99.00.0.0.0 255.255.255.0 U 000 eth0127.0.0.0 0.0.0.0 255.0.0.0 U 000 lo0.0.0.0 192.168.99.2540.0.0.0 UG000 eth0
|
Adding a static route with route
[root@morgan]# route -n Kernel IP routing tableDestination Gateway Genmask Flags Metric RefUse Iface192.168.99.00.0.0.0 255.255.255.0 U 000 eth0127.0.0.0 0.0.0.0 255.0.0.0 U 000 lo0.0.0.0 192.168.99.2540.0.0.0 UG000 eth0 [root@morgan]# route add -net 192.168.98.0 netmask 255.255.255.0 gw 192.168.99.1 [root@morgan]# route -n Kernel IP routing tableDestination Gateway Genmask Flags Metric RefUse Iface192.168.99.00.0.0.0 255.255.255.0 U 000 eth0192.168.98.0192.168.99.1255.255.255.0 UG000 eth0127.0.0.0 0.0.0.0 255.0.0.0 U 000 lo0.0.0.0 192.168.99.2540.0.0.0 UG000 eth0
|
Links
http://linux-ip.net/html/basic-changing.html
Like this:
Like Loading...