Network Configuration
Identify the Ethernet Interfaces:
$ ip link
The Ethernet Interfaces are located in /sys/class/net
For detail hardware information, use lshw:
$ sudo lshw -class network
Other program is ethtool, it’s not installed in Ubuntu by default.
$ sudo apt install ethtool
Static IP Address Assignment
To configure static IP address assignment, add the static method to the inet address family statement for the appropriate interface in the file /etc/network/interfaces.
$ sudo vi /etc/network/interfaces
In this example, the name of the interface is enp0s3 instead of eth0:
auto enp0s3
iface enp0s3 inet static
address 10.0.0.100
netmask 255.255.255.0
gateway 10.0.0.1
# Optional MTU size, Jumbo Frame
mtu 9216
By adding an interface to the configuration file, enable the interface:
$ sudo ifup enp0s3
To manually disable the interface, you can use the ifdown command:
$ sudo ifdown enp0s3
To Re-start Networking service:
$ sudo /etc/init.d/networking restart
DHCP IP Address
To use DHCP, add the dhcp in the inet line instead of static:
$ sudo /etc/network/interfaces
auto enp0s3
iface enp0s3 inet dhcp
Temporary IP Address Assignment
Use ifconfig:
$ sudo ifconfig enp0s3 10.0.0.100 netmask 255.255.255.0
$ sudo route add default gw 10.0.0.1 enp0s3
To remove the Temporary IP Address:
$ sudo ip addr flush enp0s3