文章目录
1.临时设定
1.1 ifconfig命令
1.1.1 安装命令
在rhel7中,ifconfig需要自己安装才可以使用,我们可以查看自己是否已经安装:
[root@server ~]# rpm -qf /sbin/ifconfig
net-tools-2.0-0.17.20131004git.el7.x86_64
如果没有查询出来,使用yum进行安装:
[root@server ~]# yum whatprovides */ifconfig
Loaded plugins: langpacks
rhel7/filelists_db | 3.0 MB 00:00
net-tools-2.0-0.17.20131004git.el7.x86_64 : Basic networking tools
Repo : rhel7
Matched from:
Filename : /sbin/ifconfig # ficonfig命令包含在这个软件包中
[root@server ~]# yum install net-tools -y # 安装软件包
1.1.2 查看网卡设备
[root@server ~]# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.25.5.10 netmask 255.255.255.0 broadcast 172.25.5.255
inet6 fe80::5054:ff:fe00:50a prefixlen 64 scopeid 0x20<link>
ether 52:54:00:00:05:0a txqueuelen 1000 (Ethernet)
RX packets 413 bytes 3144511 (2.9 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 308 bytes 32690 (31.9 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
ether 52:54:00:d3:36:54 txqueuelen 1000 (Ethernet)
RX packets 41 bytes 5284 (5.1 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
ether 52:54:00:e1:dc:0e txqueuelen 1000 (Ethernet)
RX packets 41 bytes 5284 (5.1 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 0 (Local Loopback)
RX packets 30 bytes 1948 (1.9 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 30 bytes 1948 (1.9 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
这里有三块物理网卡eth0、eth1、eth2,lo为回环接口,代表自己本身。
1.1.3 设置IP
ifconfig使用以下命令,这里设定的是临时IP,重启失效:
ifc |
---|