Monday, April 29, 2024
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 44488  / 3 Years ago, tue, july 20, 2021, 2:05:00

I have an Ubuntu server and I cannot get Internet connection over this. The IP,subnet,gateway and the 2 DNS servers that I have been given is standard addresses that I must put into.
I will give details of this:



1)



ping 8.8.8.8 


returns



Network is unreachable


2)



sudo nano /etc/network/interfaces


is set to



#The loopback network interface
auto lo
iface lo inet loopback

#The primary network interface
#auto eth0 <-- this is a comment
iface eth0 inet static
address "My_static_ip_here"
netmask 255.255.255.0
gateway "My_Gateway_here"


3)



sudo nano /etc/resolve.conf


is set to



nameserver "My_DNS_server_1_here"
nameserver "My_DNS_server_2_here"


Finally, ifconfig



returns 127.0.0.1 address and a subnet 255.0.0.0 ofcourse on lo
I cannot give detailed ifconfig here because of the limitations that I got.
PS: This is a virtual machine that I am using.
PS2: I tried to auto-dhcp it with iface eth0 inet dhcp but during the networking restart it kept loading and loading forever, so that does not work and I want to give this static IP.


More From » command-line

 Answers
6

Try this:



Place the DNS servers in /etc/network/interfaces, not in /etc/resolv.conf



Add this line at the bottom of your static configurations



dns-nameservers 208.67.222.222 208.67.220.220 #OpenDNS' servers as example


Then run these commands in the terminal to restart the interface.



sudo su

ifdown eth0 && ifup eth0


Hope this works!


[#29376] Tuesday, July 20, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
rcraftemur

Total Points: 118
Total Questions: 119
Total Answers: 144

Location: Turks and Caicos Islands
Member since Sun, Mar 7, 2021
3 Years ago
;