标签:ping roo loopback ati 重启 seq mtu local pre
1.临时增加
1)先查看目前的网卡信息
[root@study ~]# ifconfig
eno16777736: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.218.138 netmask 255.255.255.0 broadcast 192.168.218.255
inet6 fe80::20c:29ff:feda:49b1 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:da:49:b1 txqueuelen 1000 (Ethernet)
RX packets 8990 bytes 823774 (804.4 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 3603 bytes 808211 (789.2 KiB)
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 192 bytes 18960 (18.5 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 192 bytes 18960 (18.5 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
2)新增一个虚拟端口,并配置IP地址
[root@study ~]# ifconfig eno16777736:1 192.168.217.140 netmask 255.255.255.0 up
#up表示当即生效,另外,如果想关闭某个端口,可以ifconfig eno16777736:1down
[root@study ~]# ping 192.168.217.140
PING 192.168.217.140 (192.168.217.140) 56(84) bytes of data.
64 bytes from 192.168.217.140: icmp_seq=1 ttl=64 time=0.010 ms
64 bytes from 192.168.217.140: icmp_seq=2 ttl=64 time=0.021 ms
查看当前路由
[root@study ~]# netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 192.168.218.2 0.0.0.0 UG 0 0 0 eno16777736
192.168.217.0 0.0.0.0 255.255.255.0 U 0 0 0 eno16777736
192.168.217.0 0.0.0.0 255.255.255.0 U 0 0 0 eno16777736
192.168.218.0 0.0.0.0 255.255.255.0 U 0 0 0 eno16777736
3)设置路由
对应新IP,新增一个网段,使这个网段能够访问
[root@study ~]# route add -net 192.168.217.0 netmask 255.255.255.0 gw 192.168.217.1 eno16777736:1
2.永久性新增一个IP
1)在/etc/sysconfig/network-scripts/下,新增ifcfg-eno16777736:1文件
修改成
DEVICE=eno16777736:1
#BOOTPROTO=dhcp
BOOTPROTO=static
HWADDR=00:0c:29:da:49:b1
ONBOOT=yes
IPADDR=192.168.217.140
NETMASK=255.255.255.0
TYPE=Ethernet
GATEWAY=192.168.217.1
2)重启网络服务
[root@study ~]# /etc/init.d/network restart
标签:ping roo loopback ati 重启 seq mtu local pre
原文地址:https://www.cnblogs.com/DevonL/p/11143573.html