MTU indicates the maximum transmission unit. MTU values are not necessarily the same for different local networks. for Ethernet, MTU sets the Linux command line to modify the IP address, Gateway, and DNS methods.
Method 1:
Ifconfig eth0 192.168.1.18 netmask 255.255.255.0
Note: This method can make changes take effect immediately, and will be restored to the original IP address after restart.
Method 2:
Vi/etc/sysconfig/network-scripts/ifcfg-eth0
Note: This method takes effect after being restarted and is permanent.
If you want to change it immediately and it will take effect permanently, you can only use the two methods at the same time.
The preceding method modifies the IP address through the linux command line.
-----------------------
Modify the nic ip address and Gateway in Linux
We recommend that you use the terminal character to modify it.
1. modify the IP address
Vi/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE = eth0
BOOTPROTO = none
BROADCAST = 192.168.1.255
IPADDR = 192.168.1.33
NETMASK = 255.255.255.0
NETWORK = 192.168.1.0
ONBOOT = yes
USERCTL = no
PEERDNS = no
TYPE = Ethernet
~
Vi/etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE = eth1
ONBOOT = yes
BOOTPROTO = none
IPADDR = 192.168.2.34
NETMASK = 255.255.255.0
USERCTL = no
PEERDNS = no
TYPE = Ethernet
NETWORK = 192.168.2.0
BROADCAST = 192.168.2.255
2. modify the Gateway
Vi/etc/sysconfig/network
# Realtek semiconduco., Ltd. RTL-8139/8139C/8139C +
DEVICE = eth0 interface name
BOOTPROTO = none static configuration. if this value is "dhcp", it is dynamically obtained. static also indicates static IP address.
BROADCAST = 192.168.10.255 BROADCAST address, automatically calculated by IP address and subnet mask
HWADDR = 00: 13: D3: 27: 9F: 80
IPADDR = 192.168.10.238
IPV6INIT = yes
IPV6_AUTOCONF = yes
NETMASK = 255.255.255.0
NETWORK = 192.168.10.0 indicates the NETWORK, which is automatically calculated using the IP address and subnet mask.
ONBOOT = yes automatically loaded upon startup
GATEWAY = 192.168.10.1
TYPE = Ethernet
PEERDNS = yes
USERCTL = no
Ifdown eth0 disable network
Ifconfig eth0 down disable network
Ifup eth0 enable network
Ifconfig eth0 up enable network
Other aspects
Service network start // start a network service
Service network stop // stop a network service
Service network restart // restart the network service
Service network status // view the network service status
Ifconfig eth0 192.168.10.222 netmask 255.255.255.0 // temporarily modify the interface IP address (no need to restart the interface)
[Yeger @ yeger ~] $ Sudo ifconfig wlan0 192.168.21.199 netmask 255.255.255.0
[Yeger @ yeger ~] $ Ifconfig wlan0
Wlan0 Link encap: Ethernet HWaddr 00: 02: 72: 77: BB: D1
Inet addr: 192.168.21.199 Bcast: 192.168.21.255 Mask: 255.255.255.0
Inet6 addr: fe80: 202: 72ff: fe77: bbd1/64 Scope: Link
Up broadcast running multicast mtu: 1500 Metric: 1
RX packets: 3246 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets: 1947 errors: 0 dropped: 0 overruns: 0 carrier: 0
Collisions: 0 fig: 1000
RX bytes: 4514869 (4.3 MiB) TX bytes: 177732 (173.5 KiB)
Wlan0 indicates the first wireless Ethernet card
Link encap indicates the name of the network adapter in the OSI Physical Layer.
HWaddr indicates the MAC Address of the NIC (Hardware Address)
Inet addr indicates the IP address of the network adapter in the TCP/IP network.
Bcast indicates the broadcast Address (Broad Address)
Mask indicates the Subnet Mask (Subnet Mask)
MTU indicates the maximum transmission unit. MTU values are not necessarily the same for different local networks. for Ethernet, the default MTU value is 1500 bytes.
Metric indicates the Metric value, which is usually used to calculate the route cost.
RX indicates the received data packet
TX indicates the sent data packet
Collisions indicates the number of packet conflicts
Txqueuelen indicates the Transfer Queue length.
Interrupt indicates the IRQ interrupt number of the Eni.
Base address indicates the I/O address
Configure the virtual network interface IP address: the network interface must have multiple IP addresses.
Command format: ifconfig Nic name: Virtual nic id ip address netmask subnet mask
MTU field: indicates the maximum transmission unit, that is, the maximum number of packets transmitted by network interfaces.
Met field: indicates the metric value. The smaller the value, the higher the priority.
RX-OK/TX-OK: number of packets received and sent, respectively.
RX-ERR/TX-ERR: number of error packets received and sent.
RX-DRP/TX-DRP: indicates the number of dropped.
RX-OVR/TX-OVR: indicates the number of dropped packets.
[Yeger @ yeger ~] $ Nslookup test domain name resolution
Server: 202.96.128.86
Address: 202.96.128.86 #53
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.