eemoon
asked on
Ubuntu cannot ping its neighbor
Hi
root@NetworkAutomation-1:~# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet6 fe80::58bb:7dff:fe82:ac8a prefixlen 64 scopeid 0x20<link>
ether 5a:bb:7d:82:ac:8a txqueuelen 1000 (Ethernet)
RX packets 100 bytes 9979 (9.9 KB)
RX errors 0 dropped 93 overruns 0 frame 0
TX packets 15 bytes 1146 (1.1 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 96 bytes 7264 (7.2 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 96 bytes 7264 (7.2 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
I am new to Ubuntu. An Ubuntu device is connected to a router with same ip subnet, but it cannot ping the router and then I noticed it cannot ping itself too. It looks like it does not have ip address on it. Please see the below. Do you think so? if so, can you give suggestion or share a link how to add ip address on the interface? Thank you
root@NetworkAutomation-1:~# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet6 fe80::58bb:7dff:fe82:ac8a prefixlen 64 scopeid 0x20<link>
ether 5a:bb:7d:82:ac:8a txqueuelen 1000 (Ethernet)
RX packets 100 bytes 9979 (9.9 KB)
RX errors 0 dropped 93 overruns 0 frame 0
TX packets 15 bytes 1146 (1.1 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 96 bytes 7264 (7.2 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 96 bytes 7264 (7.2 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Correct deduction there is no IP address.
Check the /etc/network directory for the interfaces file
it should have something along:
Check the /etc/network directory for the interfaces file
it should have something along:
# 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
auto eth0
iface eth0 inet dhcp
inet6 dhcpv6
To obtain an DHCP address.
ASKER
# 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
auto eth0
iface eth0 inet
address 192.168.1.125
netmask 255.255.255.0
gateway 192.168.1.1
inet6 dhcpv6
Better choose a different network from 192.168.1.0/24 try one of the other 256 network available. (random from the range).
did you run dhclient or restart the network after adding the pool ?
static and dhcp should both work. just a matter of choice and we have no idea regarding your setup.
whatever config you use, check what happened with ifconfig
side notes :
- ubuntu is switching to netplan so /etc/network/interfaces may not work as expected
- ifup/ifdown commands have been broken in ubuntu since ubuntu 14 so do not rely on them too much
static and dhcp should both work. just a matter of choice and we have no idea regarding your setup.
whatever config you use, check what happened with ifconfig
side notes :
- ubuntu is switching to netplan so /etc/network/interfaces may not work as expected
- ifup/ifdown commands have been broken in ubuntu since ubuntu 14 so do not rely on them too much
ASKER
Why the Networkautomation-1 cannot ping itself 192.168.0.2? Is this normal? it cannot ping its neighbor (192.168.0.1) too. The ip address (192.168.0.2) looks like to be static ip address. Is this default ip address?
did you run dhclient or restart the network after adding the pool ?yes, I tried it. but i could not see any difference.
unless you restart the network, making changes to the file does nothing.
check the current ip with ifconfig or "ip a"
you most definitely should be able to ping yourself if the ip is actually set.
check the current ip with ifconfig or "ip a"
you most definitely should be able to ping yourself if the ip is actually set.
ASKER
Please see below. this eth0 does not show any ipv4 address. What command I can use to add a static ipv4 address to eth0?
root@NetworkAutomation-2:~# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet6 fe80::884f:b1ff:fe24:5d49 prefixlen 64 scopeid 0x20<link>
ether 8a:4f:b1:24:5d:49 txqueuelen 1000 (Ethernet)
RX packets 189 bytes 19046 (19.0 KB)
RX errors 0 dropped 154 overruns 0 frame 0
TX packets 14 bytes 1076 (1.0 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 48 bytes 3264 (3.2 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 48 bytes 3264 (3.2 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
root@NetworkAutomation-2:~# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet6 fe80::884f:b1ff:fe24:5d49 prefixlen 64 scopeid 0x20<link>
ether 8a:4f:b1:24:5d:49 txqueuelen 1000 (Ethernet)
RX packets 189 bytes 19046 (19.0 KB)
RX errors 0 dropped 154 overruns 0 frame 0
TX packets 14 bytes 1076 (1.0 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 48 bytes 3264 (3.2 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 48 bytes 3264 (3.2 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
if there is a # mark on a line anything after it is Comment and not actualy used.
Remove the # marks on lines whter the are not needed. (Compare to my previous comment).
Remove the # marks on lines whter the are not needed. (Compare to my previous comment).
ASKER
Hi noci, Can you share how to enter that status or remove the # mark? Thank you.
lol, missed that !
use a text editor
then resart the network or ifdown and ifup and check the results with ifconfig
use a text editor
then resart the network or ifdown and ifup and check the results with ifconfig
ASKER
i did it, but nothing happened
Edit the file into:
# 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 Ethernet adapter.
auto eth0
iface eth0 inet
address 192.168.0.2
netmask 255.255.255.0
gateway 192.168.0.1
# inet6 dhcpv6
Note that will NOT talk to your router that you had setup with 192.168.1.1 in an earlier image.
two possible issues
your ubuntu version might be using netplan so changes to this file might be ignored
you messed up with the command or hit a bug. many recent ubuntu versions are plagued with bugs in network restart or ifup and down
you can setup an ip manually till you figure it out ( we can help if you post commands and output and the ubuntu version. use lsb_release -a ) using "ifconfig eth0 192.whatever"
your ubuntu version might be using netplan so changes to this file might be ignored
you messed up with the command or hit a bug. many recent ubuntu versions are plagued with bugs in network restart or ifup and down
you can setup an ip manually till you figure it out ( we can help if you post commands and output and the ubuntu version. use lsb_release -a ) using "ifconfig eth0 192.whatever"
ASKER
root@NetworkAutomation-2:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.4 LTS
Release: 18.04
Codename: bionic
I noticed even if I removed the # and then save/refresh, i still cannot see ipv4 address on eth0 using ifconfig. As the interface eth0 does not have ip address, it should not ping to itself. So what i might need to do is to add the ip address. but it looks like the ip address cannot be added. Why cannot?
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.4 LTS
Release: 18.04
Codename: bionic
I noticed even if I removed the # and then save/refresh, i still cannot see ipv4 address on eth0 using ifconfig. As the interface eth0 does not have ip address, it should not ping to itself. So what i might need to do is to add the ip address. but it looks like the ip address cannot be added. Why cannot?
To do manual for testing....
Please show your CURRENT interfaces file (text format, not an image).
ifconfig eth0 192.168.0.2 netmask 255.255.255.0
route add default gw 192.168.0.1
ping 192.168.0.1
traceroute 1.1.1.1
Please show your CURRENT interfaces file (text format, not an image).
ASKER
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Great! Thank you noci
Addition question: right click on Networkautomation-1 ----> Edit config. When i change it, why the change cannot work. for example, i change its ip address on eth0, but i cannot see the change when issuing command ifconfig
Addition question: right click on Networkautomation-1 ----> Edit config. When i change it, why the change cannot work. for example, i change its ip address on eth0, but i cannot see the change when issuing command ifconfig
After setting the config you need to either stop/start the interface on command line:
reboot the system.
When the commands have been given manual then after restart of the system the settings are LOST.
ifdown eth0
ifup eth0
Alternatively:reboot the system.
When the commands have been given manual then after restart of the system the settings are LOST.
you can define this in /etc/network/interfaces on older versions and somewhere in /etc/netplan or using the ethtool command on newer ones. you will find good docs if you google it.