1 số lệnh show
+ Kiểm tra trạng thái mạng:
# systemctl status NetworkManager
# ip link
# ip addr show dev ens3
+ display devices: # nmcli d
+ show settings: # nmcli d show eth0
+ show status:
# ip addr show
# ip a
Cấu hình mạng CentOS
+ ls /etc/sysconfig/network-scripts/
+ vi /etc/sysconfig/network-scripts/ifcfg-enp0s3
- sửa:
BOOTPROTO=static
ONBOOT=yes
- Thêm cấu hình dưới BOOTPROTO=static:
IPADDR=192.168.18.100
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS1=210.245.31.220
DNS2=115.84.181.20
+ # systemctl restart network.service (rocky linux thì # reboot)
Disable IPv6 CentOS 7, Rocky Linux 8
+ Sửa file: # vi /etc/default/grub
line 6 add: ipv6.disable=1
GRUB_CMDLINE_LINUX=”ipv6.disable=1 rd.lvm.lv=fedora-server/root…..
+ apply changing
# grub2-mkconfig -o /boot/grub2/grub.cfg
# reboot
+ enable lại IPv6 thì sửa ipv6.disable=0
Disable IPv6 CentOS Stream 8
# disable IPv6
[root@thanhdd ~]# grubby –update-kernel ALL –args ipv6.disable=1
# verify kernel parameters
[root@thanhdd ~]# grubby –info DEFAULT
[root@thanhdd ~]# reboot
# if falling back to enable, run like follows
[root@thanhdd ~]# grubby –update-kernel ALL –remove-args ipv6.disable
Network Settings Unbutu
+ Xem tên file cấu hình network: # ls /etc/netplan
+ # sudo vi /etc/netplan/01-netcfg.yaml
+ sửa file (thò thụt đầu dòng đúng):
network: version: 2 renderer: networkd ethernets: ens3: dhcp4: no # IP address/subnet mask addresses: [10.0.0.30/24] # default gateway gateway4: 10.0.0.1 nameservers: # name server this host refers addresses: [10.0.0.10,10.0.0.11] dhcp6: no
+ apply settings: # sudo netplan apply
Disable IPv6 Unbutu
+ # sudo vi /etc/sysctl.conf
+ Thêm dòng này vào file: net.ipv6.conf.all.disable_ipv6 = 1
+ # sysctl -p
+ Enable IPv6 lại thì đổi net.ipv6.conf.all.disable_ipv6 = 0