Nic naming rules in Linux: eth0 and eth1. The first Ethernet Card and the second card. Lo is the loopback interface, its IP address is fixed to 127.0.0.1, And the mask is 8 bits. It represents your machine. The Java code ifconfig [Interface] www.2cto.com is used to view the information of the NIC. If you do not add a parameter to view information of all NICs and add the parameter eth0, it is used to view information about the NIC of eth0: line 1: Connection Type: Ethernet (Ethernet) HWaddr (hardware mac address) Line 2: IP address of the NIC, subnet, mask line 4: UP (indicating that the NIC is enabled) RUNNING (indicating that the network card is connected) MULTICAST (supports MULTICAST)
MTU: 1500 (maximum transmission unit): 1500 bytes under www.2cto.com is the statistics on the number of received and sent data packets and the number of bytes sent and received data. Configure the IP address of the NIC Java code ifconfig eth0 192.168.168.64 netmask 255.255.255.255.0 configure the IP address and subnet mask of 192.168.168.64 on eth0. Configure the hardware address of the NIC. Java code ifconfig eth0 hw ether xx: xx disable Nic eth0 Java code ifconfig eth0 down www.2cto.com enable Nic eth0 Java code ifconfig eth0 up enable Nic ifup | ifdown eth0
Author renhongchao