I'm trying to set up a static local IP address for my Linux computer for port-forwarding purposes. As per every single guide that exists on this subject, I've edited my /etc/network/interfaces
and /etc/resolv.conf
files accordingly. However, upon rebooting, any changes I've made to resolv.conf
are erased and the file is blank (except for the comment that warns me of exactly that).
As a result, I'm unable to resolve hostnames (ping google.com
fails, for example). In fact, I can't even ping valid IP addresses ("Destination Host Unreachable").
Although ifconfig
seems to reflect all the settings I put in /etc/network/interfaces
, I am unable to access the Internet whatsoever, nor can I access the machine using SSH or FTP from another machine.
Here's my /etc/network/interfaces
:
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.0.64
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
dns-nameservers 192.168.0.1 8.8.8.8
Here's what ifconfig
gives me:
eth0 Link encap:Ethernet HWaddr 00:25:90:57:7c:65
inet addr:192.168.0.64 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:20 Memory:fba00000-fba20000
eth1 Link encap:Ethernet HWaddr 00:25:90:57:7c:64
inet addr:192.168.0.10 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::225:90ff:fe57:7c64/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:252 errors:0 dropped:0 overruns:0 frame:0
TX packets:106 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:54010 (54.0 KB) TX bytes:15731 (15.7 KB)
Interrupt:16 Memory:fb900000-fb920000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:94 errors:0 dropped:0 overruns:0 frame:0
TX packets:94 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:8088 (8.0 KB) TX bytes:8088 (8.0 KB)
Why is this happening and how can I fix it?