configuration network commonly used add, delete, change search command
modify the IP address
- modify the configuration file
/etc/sysconfig/network-scripts/ifcfg-ens33
blockquote> li>
- ifconfig command
ifconfig ens33:0 192.168.235.127/24
li>
- IP command
ip addr add 192.168.235.127/24 dev ens33 label ens33:1
li>
- nmcli command
nmcli connection modify ens33 ipv4.address 192.168.80.100/24 # 修改ip地址 nmcli connection modify ens33 ipv4.gateway 192.168.80.2/24 #修改网关 nmcli connection modify ens33 ipv4.dns1 114.114.114.114 # 修改dns信息 nmcli connection modify ens33 ipv4.method mannual # 指定网络信息获取方式为手动指定
- ifconfig command
open/disable network card
- ifconfig command
ifconfig ens33 up ifconfig ens33 down
li>
- ifup/ifdown command
ifup ens33 ifdown ens33
li>
- IP command
ip link set ens33 up ip link set ens33 down
li>
- nmcli command
nmcli device connect ens33 nmcli device disconnect ens33
add routing
- modify the configuration file
/etc/sysconfig/network-scripts/route-ens33
The
- way
target via gw
220.181.38.148 via 192.168.80.2 -
each three lines defines a route
ADDRESS0=TARGET
NETMASK0=MASK
GATEWAY0=GWBlockquote> li>
- way
- route command
route add -net 192.168.235.0 netmask 255.255.255.0 gw 192.168.235.2 dev ens33
li>
- IP command
ip route add 192.168.80.0/24 via 192.168.80.2 dev ens33 # 添加网络路由 ip route add 192.168.80.100 via 192.168.80.0 dev ens33 #添加主机路由 ip route add default via 192.168.80.2 dev ens33 # 添加默认路由
modify routing
- modify the configuration file
/etc/sysconfig/network-scripts/route-ens33
The
- way
target via gw
220.181.38.148 via 192.168.80.2 -
each three lines defines a route
ADDRESS0=TARGET
NETMASK0=MASK
GATEWAY0=GWBlockquote> li>
- way
- IP command
ip route change # 如果路由本身不存在则报错显示不存在 ip route replace # 如果路由本身不存在则会直接创建该路由信息
delete route
- delete the configuration file
/etc/sysconfig/network-scripts/route-ens33
blockquote> li>
- the route command
route del -net 192.168.235.0 netmask 255.255.255.0 gw 192.168.235.2 dev ens33
li>
- IP command
ip route del 192.168.80.0/24 via 192.168.80.2 dev ens33
- the route command
view routing table
- the route command
route -n
li>
- netstat command
netstat -r # 显示内核路由表 netstat -n # 数字格式(不进行反向解析)
Read More:
- The route addition failed: Either the interface index is wrong or the gateway do es not lie on the s
- How to disable Network Manager on Linux
- Path cannot be used with params in this. $router. Push() method, otherwise params will be invalid
- Determining IP information for eth0… failed; no link present. Check cable?
- Ubuntu network configuration+Fixing “Failed to bring up eth0” in Ubuntu
- Mybatis automatically generated SQL error
- [FAILED] Failed to start Raise network interfaces
- Solution summary of VMware network card without IP and failure to start network card (continuous update)
- CentOS 7 installation error: Cannot find a valid baseurl for repo: base/7/x86_6
- VirtualBox + CentOS 7 virtual machine setting static IP address of host only NIC
- IP address cannot be viewed through ifconfig in virtual machine
- When ifconfig configures the network, “siocsifaddr: no such device” and “eth0: error while getting interface” appear flags:No such dev”
- ERROR: Pool overlaps with other one on this address space
- Error:Connection activation Failed: no suitable device found for this connection solution
- Altium designer 18: activeroute failed to complete any routing
- How to Configure Inter VLAN Routing on Layer 3 Switches?
- A solution to the default invalid host only mode of CentOS virtual machine in VirtualBox
- VirtualBox Failed to start LSB:Bring up/down Networking problem
- Why must microservices have gateways?