1. 程式人生 > >Centos 7 網路配置

Centos 7 網路配置

變化:ip 命令替換了ifconfig

# ip link show                                            # 顯示網路介面資訊# ip link set eth0 upi                                   # 開啟網絡卡# ip link set eth0 down                                # 關閉網絡卡# ip link set eth0 promisc on                        # 開啟網絡卡的混合模式# ip link set eth0 promisc offi                       # 關閉網絡卡的混個模式

# ip link set eth0 txqueuelen 1200                # 設定網絡卡佇列長度# ip link set eth0 mtu 1400                          # 設定網絡卡最大傳輸單元# ip addr show                                            # 顯示網絡卡IP資訊# ip addr add 192.168.0.1/24 dev eth0         # 設定eth0網絡卡IP地址192.168.0.1# ip addr del 192.168.0.1/24 dev eth0          # 刪除eth0網絡卡IP地址
# ip route list                                               # 檢視路由資訊# ip route add 192.168.4.0/24  via  192.168.0.254 dev eth0 # 設定192.168.4.0網段的閘道器為192.168.0.254,資料走eth0介面# ip route add default via  192.168.0.254  dev eth0    # 設定預設閘道器為192.168.0.254# ip route del 192.168.4.0/24      # 刪除192.168.4.0網段的閘道器

# ip route del default          # 刪除預設路由

使用nmcli配置網絡卡

命令:vi /etc/sysconfig/network-script/ifcfg-`name`

重啟網絡卡

service network restart

參照:https://www.linuxidc.com/Linux/2016-06/132420.htm

微信:18991138195 18629350104