My debian system has the ip address 192.168.111.111 and I would like to configure a default gateway which is not on the 192.168.111.0 network. As a first step I want to add a route so that I can reach the gateway from the system. So I run this command (which I thought will enable a static route to a single host), but I still can't ping the gateway:
# ip route add 126.96.36.199 dev eth0 # ping 188.8.131.52 PING 184.108.40.206 (220.127.116.11) 56(84) bytes of data. ^C --- 18.104.22.168 ping statistics --- 4 packets transmitted, 0 received, 100% packet loss, time 3023ms
Here's my configuration:
# netstat -rn Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 22.214.171.124 0.0.0.0 255.255.255.255 UH 0 0 0 eth0 192.168.111.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 # ifconfig eth0 eth0 Link encap:Ethernet HWaddr ca:eb:7c:e6:7e:98 inet addr:192.168.111.111 Bcast:192.168.111.255 Mask:255.255.255.0 inet6 addr: fe80::c8eb:7cff:fee6:7e98/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:45 errors:0 dropped:0 overruns:0 frame:0 TX packets:291 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:52454 (51.2 KiB) TX bytes:39433 (38.5 KiB) Interrupt:23 # cat /etc/network/interfaces # This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The loopback network interface auto lo iface lo inet loopback # The internal network interface allow-hotplug eth0 iface eth0 inet static address 192.168.111.111 netmask 255.255.255.0 network 192.168.111.0 broadcast 192.168.111.255 # cat /proc/sys/net/ipv4/ip_forward 1
I have verified that the gateway will respond to ping if I use an IP address in its network, unfortunately that is not an option because the system can't have a real (not in 192.168.x.x) ip address in that range.