Monday, May 6, 2024
 Popular · Latest · Hot · Upcoming
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 12845  / 2 Years ago, mon, february 28, 2022, 3:26:38

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?


More From » 12.04

 Answers
6

If you are using a desktop version of Ubuntu, with a graphical network-manager tool installed, then you should not define the connection in the /etc/network/interfaces file.



Instead, open the connection via the nm-applet on the desktop (or by invoking nm-connection-editor from a terminal), navigate to the IPv4 settings tab, and set the connection mode to Manual using the drop-down selection box. Then add your desired IP and DNS settings in the boxes provided.



You should then revert any edits to your /etc/network/interfaces file (so that it contains only the lo definition lines) and either restart both the networking and network-manager services or reboot the machine.



You should also make sure that the chosen static IP address is outside the DHCP pool assigned by your router - in fact, you may find it simpler to keep a DHCP configuration on the machine, and reserve a particular IP for it on the router, if it supports DHCP address reservation.



If you really want to keep the GUI network-manager, but define your interface via /etc/network/interfaces, then you could try editing /etc/NetworkManager/NetworkManager.conf, changing



[ifupdown]
managed=false


to



[ifupdown]
managed=true


and then making sure there are no other competing connections defined in the /etc/NetworkManager/system-connections/ directory (where 'competing' means 'using the same interface as'). This should allow you to see and control the connections in /etc/network/interfaces under the GUI network-manager applet.



Alternatively you could remove the network-manager package altogether.


[#29287] Tuesday, March 1, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
eballxeye

Total Points: 370
Total Questions: 91
Total Answers: 139

Location: Suriname
Member since Sat, Jan 1, 2022
2 Years ago
eballxeye questions
Sun, Jan 8, 23, 18:23, 1 Year ago
Sun, Sep 11, 22, 23:24, 2 Years ago
Tue, Dec 14, 21, 07:15, 2 Years ago
;