Verifying Network interfaces and Assigned IP Addresses
To display network interfaces and their assigned IP addresses and nameserver addresses, type the show interface
LYSH@MyHostName# show interface lo: stats : operate=up, up=yes, speed=0MB, duplex=?, mtu=65536 incoming : bytes=79.3G, pkts=310057073, errs=0, drops=0 outgoing : bytes=79.3G, pkts=310057073, errs=0, drops=0 IPv4 address : 127.0.0.1/8 IPv6 address : ::1/128 MAC address : 00:00:00:00:00:00 eth0: stats : operate=up, up=yes, speed=100MB, duplex=full, mtu=1500 incoming : bytes=15.1G, pkts=93920605, errs=0, drops=6869214 outgoing : bytes=65.9G, pkts=76383487, errs=0, drops=0 gateway4 : 192.168.0.1 IPv4 address : 192.168.0.40/24 MAC address : 00:01:a2:92:1e:f3 ...... DNS Servers: 8.8.8.8 8.8.4.4 LYSH@MyHostName# show interface eth0 // Display only eth0 eth0: stats : operate=up, up=yes, speed=100MB, duplex=full, mtu=1500 incoming : bytes=15.1G, pkts=93920605, errs=0, drops=6869214 outgoing : bytes=65.9G, pkts=76383487, errs=0, drops=0 gateway4 : 192.168.0.1 IPv4 address : 192.168.0.40/24 MAC address : 00:01:a2:92:1e:f3 ...... DNS Servers: 8.8.8.8 8.8.4.4
Assigning the IP address
Both IPv4 and IPv6 addresses can be configured in the configuration mode.
LYSH@MyHostName# configure // Enters configuration mode. LYSH@MyHostName(config)# ip add eth0 192.168.0.3/24 192.168.0.1 // Configures an IPv4 address, subnet, and gateway.(i.e. 192.168.0.1) LYSH@MyHostName(config)# ip add eth0 2000:4::40/64 2000:4::1 // Configures an IPv6 address, prefix, and gateway.(i.e, 2000:4::1) interface setting was added. Do you want to apply these settings?(y/n): y // immediately apply the configurations. LYSH@MyHostName(config)# exit LYSH@MyHostName# show interface LYSH@MyHostName# ping 192.168.0.1 LYSH@MyHostName# ping6 2000:4::1
Note that, If a network interface already has an assigned IP address and you configure another IP address and gateway of the same version, the gateway is ignored. In the words, the secondary gateway of the same version is not allowed.
Deleting the IP address
LYSH@MyHostName# configure // Enters configuration mode. LYSH@MyHostName(config)# ip delete eth0 192.168.0.3/24 // Deletes an IPv4 address(i.e. 192.168.0.3/24) LYSH@MyHostName(config)# ip delete eth0 2000:4::40/64 // Deletes an IPv6 address(i.e. 2000:4::40/64) interface setting was deleted. Do you want to apply these settings?(y/n): y // immediately apply the configurations. LYSH@MyHostName(config)# exit LYSH@MyHostName# show interface
Note that, If a network interface has multiple assigned IP addresses of the same version(i.e. IPv4 or IPv6), the gateway address is not removing before deleting all IP addresses of the same version from a network interface.
netpaln
This command allows you to apply the network configuration immediately. If you did not immediately apply the network configuration after adding or removing addresses, you can apply the new configuration with this command.
LYSH@MyHostName# configure LYSH@MyHostName(config)# netplan apply
nameserver
You can add or delete a nameserver of a network interface. To verify the configured nameservers, enter the show interface
command in the user mode.
LYSH@MyHostName# configure LYSH@MyHostName(config)# nameserver add eth0 8.8.8.8 // add a nameserver, 8.8.8.8, into the eth0 interface. LYSH@MyHostName(config)# nameserver delete eth0 8.8.4.4 // delete a nameserver, 8.8.8.8, from the eth0 interface. LYSH@MyHostName(config)# exit LYSH@MyHostName# show interface eth0 stats : operate=up, up=yes, speed=100MB, duplex=full, mtu=1500 incoming : bytes=15.1G, pkts=93920605, errs=0, drops=6869214 outgoing : bytes=65.9G, pkts=76383487, errs=0, drops=0 gateway4 : 192.168.0.1 IPv4 address : 192.168.0.40/24 MAC address : 00:01:a2:92:1e:f3 ...... DNS Servers: 8.8.8.8 8.8.4.4
Verifying Multicast Group
To display multicast group membership information for IPv4 and IPv6, enter the show multicast
command.
LYSH@MyHostName# show multicast 1: lo inet 224.0.0.1 inet6 ff02::1 inet6 ff01::1 2: eth0 link 01:80:c2:00:00:00 inet 224.0.0.1 inet6 ff05::1:3 inet6 ff02::1:2 inet6 ff02::1:ff00:40