文章目录
修改网卡命名
cd /etc/sysconfig/network-scripts/
[root@localhost network-scripts]# ls
ifcfg-eno16777736 ifdown-ippp ifdown-routes ifup ifup-ipv6 ifup-ppp ifup-tunnel
ifcfg-lo ifdown-ipv6 ifdown-sit ifup-aliases ifup-isdn ifup-routes ifup-wireless
ifdown ifdown-isdn ifdown-Team ifup-bnep ifup-plip ifup-sit init.ipv6-global
ifdown-bnep ifdown-post ifdown-TeamPort ifup-eth ifup-plusb ifup-Team network-functions
ifdown-eth ifdown-ppp ifdown-tunnel ifup-ippp ifup-post ifup-TeamPort network-functions-ipv6
[root@localhost network-scripts]# mv ifcfg-eno16777736 ifcfg-eth0
[root@localhost network-scripts]# ls
ifcfg-eht0 ifdown-ippp ifdown-routes ifup ifup-ipv6 ifup-ppp ifup-tunnel
ifcfg-lo ifdown-ipv6 ifdown-sit ifup-aliases ifup-isdn ifup-routes ifup-wireless
ifdown ifdown-isdn ifdown-Team ifup-bnep ifup-plip ifup-sit init.ipv6-global
ifdown-bnep ifdown-post ifdown-TeamPort ifup-eth ifup-plusb ifup-Team network-functions
ifdown-eth ifdown-ppp ifdown-tunnel ifup-ippp ifup-post ifup-TeamPort network-functions-ipv6
[root@localhost network-scripts]# vi ifcfg-eht0
//
HWADDR=00:0C:29:41:29:B7
TYPE=Ethernet
BOOTPROTO=dhcp
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME=eth0
DEVICE=eth0
UUID=b28f4cc9-81d3-43bc-a946-f12f0ab2d596
ONBOOT=yes
~
~
~
~
~
~
~
~
"ifcfg-eth0" 17L, 299C
//
[root@localhost network-scripts]# vi /etc/default/grub
//
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="rd.lvm.lv=rhel/root crashkernel=auto rd.lvm.lv=rhel/swap vconsole.font=latarcyrheb-sun16 vconsole.keymap=us net.ifnames=0 biosdevname=0 rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
"/etc/default/grub" 7L, 355C
</font>
[root@localhost network-scripts]# grub2-mkconfig -o /etc/grub2.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-123.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-123.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-fddb1370d1b84f6bb7659837b87e6cc4
Found initrd image: /boot/initramfs-0-rescue-fddb1370d1b84f6bb7659837b87e6cc4.img
done
[root@localhost network-scripts]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eno16777736: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:41:29:b7 brd ff:ff:ff:ff:ff:ff
inet 192.168.220.138/24 brd 192.168.220.255 scope global dynamic eno16777736
valid_lft 1068sec preferred_lft 1068sec
inet6 fe80::20c:29ff:fe41:29b7/64 scope link
valid_lft forever preferred_lft forever
[root@localhost network-scripts]# reboot
Connection closing...Socket close.
Connection closed by foreign host.
Disconnected from remote host(192.168.220.138) at 09:36:21.
Type `help' to learn how to use Xshell prompt.
[C:\~]$
Connecting to 192.168.220.138:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.
WARNING! The remote SSH server rejected X11 forwarding request.
Last login: Tue Oct 8 16:46:55 2019 from 192.168.220.1
[root@localhost ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:41:29:b7 brd ff:ff:ff:ff:ff:ff
inet 192.168.220.138/24 brd 192.168.220.255 scope global dynamic eth0
valid_lft 1794sec preferred_lft 1794sec
inet6 fe80::20c:29ff:fe41:29b7/64 scope link
valid_lft forever preferred_lft forever
ifconfig
ifconfig lo down:关闭lo网卡
这里关闭lo网卡只是暂时的,重启网卡或者终端后会重新开启
[root@localhost ~]# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.220.138 netmask 255.255.255.0 broadcast 192.168.220.255
inet6 fe80::20c:29ff:fe41:29b7 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:41:29:b7 txqueuelen 1000 (Ethernet)
RX packets 10927 bytes 4520695 (4.3 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2598 bytes 285365 (278.6 KiB)
TX errors 0 dr