4

Linux常用命令-28:ifconfig

 2 years ago
source link: https://xugaoxiang.com/2022/06/07/linux-cmds-28-ifconfig/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

ifconfig 命令用于查看和配置网络参数。使用 ifconfig 命令配置的信息,在网卡重启或机器重启后,配置就不存在。要想永远保存,就需要修改网卡的配置文件了。

语法格式:ifconfig [参数]

常用参数:

d4bfb972ed72ad0d.png
# 显示全部网络信息
ifconfig
e1af054f2067eb95.png
# 查看指定网卡
ifconfig enp0s25
6b1aa12999e5b91d.png
# 关闭网卡eth0
ifconfig eth0 down

# 启动网卡eth0
ifconfig eth0 up 

# 设置ip地址
ifconfig eth0 192.168.1.100

# 设置ip和子网掩码
ifconfig eth0 192.168.1.100 netmask 255.255.255.0

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK