# Cài đặt gói net-tools sẽ bao gồm cả công cụ ifconfig và netstat
[root@server1 ~]# yum -y install net-tools
[root@server1 ~]# vi /etc/sysconfig/network-scripts/ifcfg-eno16777736
HWADDR="00:0C:29:AB:BB:F1"
TYPE="Ethernet"
# thay đổi BOOTPROTO từ dhcp thành none
BOOTPROTO="none"
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="eno16777736"
UUID="9dedc94e-f85b-4df2-b2a1-efef021d976d"
ONBOOT="yes"
# Thiết lập địa chỉ IP tĩnh
IPADDR="192.168.1.11"
# Thiết lập mặt nạ mạng
NETMASK="255.255.255.0"
# Thiết lập cổng ra (gateway)
GATEWAY="192.168.1.1"
# Thiết lập máy chủ phân giải DNS
DNS1="8.8.8.8"
# Dừng và vô hiệu hóa NetworkManager
[root@server1 ~]# systemctl stop NetworkManager
[root@server1 ~]# systemctl disable NetworkManager
rm '/etc/systemd/system/multi-user.target.wants/NetworkManager.service'
rm '/etc/systemd/system/dbus-org.freedesktop.NetworkManager.service'
rm '/etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service'
# Khởi động lại mạng
[root@server1 ~]# systemctl restart network
[root@server1 ~]# chkconfig network on
# Xem thông số mạng
[root@server1 ~]# ifconfig
eno16777736: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.11 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::20c:29ff:feab:bbf1 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:ab:bb:f1 txqueuelen 1000 (Ethernet)
RX packets 8470 bytes 9585413 (9.1 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2913 bytes 225287 (220.0 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 0 bytes 0 (0.0 B)
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
0 Comments