网卡

linux 下 ifcfg-eth0 配置ifconfig、ifup、ifdown区别

网络接口配置文件
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
# Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)
TYPE=Ethernet       #网卡类型
DEVICE=eth0         #网卡接口名称
ONBOOT=yes          #系统启动时是否自动加载
BOOTPROTO=static    #启用地址协议 --static:静态协议 --bootp协议 --dhcp协议
IPADDR=192.168.1.11      #网卡IP地址
NETMASK=255.255.255.0    #网卡网络地址
GATEWAY=192.168.1.1      #网卡网关地址
DNS1=10.203.104.41       #网卡DNS地址
HWADDR=00:0C:29:13:5D:74 #网卡设备MAC地址
BROADCAST=192.168.1.255  #网卡广播地址 
从新导入ifcfg-eth0网络配置文件
[root@localhost ~]# /etc/init.d/network reload
Shutting down interface eth0:                             [ OK ]
Shutting down loopback interface:                         [ OK ]
Bringing up loopback interface:                           [ OK ]
Bringing up interface eth0:                               [ OK ]

网卡接口关闭与激活
[root@localhost ~]# ifdown eth0   #关闭网络
[root@localhost ~]# ifup eth0     #启动网络(须要重启网卡)
[root@web01 ~]# systemctl restart network

观察全部的网络接口(直接输入 ifconfig)
[root@linux ~]# ifconfig

[root@web01 ~]# ifdown eth0		#关闭外网网卡
[root@web02 ~]# ssh root@172.16.1.7		只能经过 切换的方式链接 内网IP来链接web01
[root@web02 ~]# ifup eth0     
[root@web01 ~]# systemctl restart network	#手动进行网卡重连没用
相关文章
相关标签/搜索