标签:host roo class ifconf scope http ack 文件中 byte
ifconfig命令
...
[li@centos7 ~]$ ifconfig ens33 ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 172.22.12.233 netmask 255.255.0.0 broadcast 172.22.255.255 inet6 fe80::7bf5:16a7:f734:b7c4 prefixlen 64 scopeid 0x20<link> ether 00:0c:29:0f:5d:ea txqueuelen 1000 (Ethernet) RX packets 287788 bytes 20207460 (19.2 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 993 bytes 197981 (193.3 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
给出指定的IP地址并激活
1、方式一:#ifconfig IFACEIP/MASK [up]
[root@localhost~]# ifconfig eno16777736 192.168.10.100/24 up [root@localhost~]# ifconfig eno16777736:flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.10.100 netmask 255.255.255.0 broadcast 192.168.10.255 inet6 fe80::20c:29ff:fee5:2d6a prefixlen 64 scopeid 0x20<link> ether 00:0c:29:e5:2d:6a txqueuelen 1000 (Ethernet) RX packets 126 bytes 44856 (43.8 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 341 bytes 63010 (61.5 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
2、方式二:#ifconfig IFACEIP netmask NETMASK
[root@localhost~]# ifconfig eno16777736 192.168.10.101 netmask 255.255.255.0 [root@localhost~]# ifconfig eno16777736:flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.10.101 netmask 255.255.255.0 broadcast 192.168.10.255 inet6 fe80::20c:29ff:fee5:2d6a prefixlen 64 scopeid 0x20<link> ether 00:0c:29:e5:2d:6a txqueuelen 1000 (Ethernet) RX packets 126 bytes 44856 (43.8 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 343 bytes 63150 (61.6 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
注意:ifconfig命令的网络配置只对当前系统有效
在远程ssh时最好不要使用,可能网络环境不同,一旦不生效,可能要跑到机房重新设置
ifconfig eth0:# IP netmask MASK,如ifconfig eth0:0 192.168.1.177 netmask 255.255.255.0
创建/etc/sysconfig/network-scripts/ifcfg-eth0:0文件,并配置即可。注意,文件中的DEVICE=eth0:0,且该接口处的IP地址不能动态的获取,需要手动设定。
注意:当一块网卡上配置多个IP地址时,如eth0、eth0:0,如果禁掉eth0:0,eth0上的网卡依然生效。但直接禁掉物理网卡时(即eth0),其后面的配置(eth0:0)等都将被删除掉。
标签:host roo class ifconf scope http ack 文件中 byte
原文地址:http://www.cnblogs.com/FernLi/p/7026359.html