
例如:网卡名 eth0
启用网卡命名 ifconfig eth0 up
禁用网卡命名 ifconfig eth0 down
验证了 suse系统/redhat系统/ubuntu系统/Frdora系统/CentOS系统,均能使用。
https://linuxconfig.org/how-to-configure-static-ip-address-on-ubuntu-18-10-cosmic-cuttlefish-linux
service network restart
1、ifconfig看下,能看到eth1代表启动着,顺便看下ip地址是否配置正确。2、ifconfig功能说明:显示或设置网络设备
语 法:ifconfig [网络设备][down up -allmulti -arp -promisc][add<地址>][del<地址>][<硬件地址>] [media<网络媒介类型>][mem_start<内存地址>][metric<数目>][mtu<字节>][netmask<子网掩码>][tunnel<地址>][-broadcast<地址>] [-pointopoint<地址>]
补充说明:ifconfig可设置网络设备的状态,或是显示目前的设置。
参 数:
[网络设备] 网络设备的名称。
down 关闭指定的网络设备。
up 启动指定的网络设备。
-arp 打开或关闭指定接口上使用的ARP协议。前面加上一个负号用于关闭该选项。
-allmuti 关闭或启动指定接口的无区别模式。前面加上一个负号用于关闭该选项。
-promisc 关闭或启动指定网络设备的promiscuous模式。前面加上一个负号用于关闭该选项。
add<地址>设置网络设备IPv6的IP地址。
del<地址>删除网络设备IPv6的IP地址。
media<网络媒介类型>设置网络设备的媒介类型。
mem_start<内存地址>设置网络设备在主内存所占用的起始地址。
metric<数目>指定在计算数据包的转送次数时,所要加上的数目。
mtu<字节>设置网络设备的MTU。
netmask<子网掩码>设置网络设备的子网掩码。
tunnel<地址>建立IPv4与IPv6之间的隧道通信地址。
-broadcast<地址>将要送往指定地址的数据包当成广播数据包来处理。
-pointopoint<地址>与指定地址的网络设备建立直接连线,此模式具有保密功能。
有的人用ifconfig -a 查网卡已经配置的正确的IP地址,可是就是ping不能网络,到机房一看网线没接,^@^! 网络不通 会有好多原因,但最先查的就是网卡的网络是还已连接并UP。就像办公室的MM喊着说上不了网,结果“本地连接”都是“X”的一样的情况。[root@localhost root]# mii-tooleth0: negotiated 100baseTx-FD, link oketh1: no link或[root@localhost root]# mii-tool -veth0: negotiated 100baseTx-FD, link okproduct info: vendor 00:50:43, model 2 rev 3basic mode: autonegotiation enabledbasic status: autonegotiation complete, link okcapabilities: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HDadvertising: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD flow-controllink partner: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HDeth1: no linkproduct info: vendor 00:50:43, model 2 rev 3basic mode: autonegotiation enabledbasic status: no linkcapabilities: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HDadvertising: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD flow-control或[root@localhost root]# mii-tool -w21:20:33 eth0: negotiated 100baseTx-FD, link ok21:20:33 eth1: no link//mii-tool主要是用于配置网卡工作模式的指令,同时也可以进行查询、监控等工作!2)[root@localhost /]# /etc/init.d/network statusConfigured devices:lo eth0 eth1Currently active devices:lo eth0等同于[root@localhost root]# service --status-allConfigured devices:lo eth0 eth1欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)