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:
- Serverlet: How to Add, Delete, Modify and Query item code
- Common linux commands — find command’s Exec
- Stata external commands: the most common and up-to-date commands
- What are the common clearing commands in MATLAB?
- Modify the name after @ in Linux
- Linux virtual machine network “job for” network.service failed because the control process exited with error code”
- Wireless network solution of deepin Linux network card driver (manual) installation
- Several methods of executing multiple commands in Linux shell
- How to disable Network Manager on Linux
- In the SQL query statement, add the column that does not exist in the table and set the fixed value of the column
- Delete files with specified suffix in specified folder under Linux
- JPA transaction problems executing an update / delete query
- CONDA creating virtual environment and common CONDA commands
- Solution summary of VMware network card without IP and failure to start network card (continuous update)
- Linux common problems and Solutions
- Problems in the second day of Android learning
- Delete the specified crontab timer task under Linux
- Common problems and solutions under Linux
- Kali Linux network manager needs to be running
- Docker creation container cannot find network card: error response from daemon: network XXXX not found