筆記 修改centos的IP位址相關配置

2022-06-26 19:09:12 字數 831 閱讀 3963

最近碰到不少認識的人問相關問題 索性做個筆記 圖個方便

修改eth0的網絡卡配置

vi /etc/sysconfig/network-scripts/ifcfg-eth0

device=eth0

bootproto=static

onboot=yes

broadcast=192.168.100.255

hwaddr=網絡卡位址不要改

ipaddr=192.168.100.25

netmask=255.255.255.0

network=192.168.100.0

修改閘道器

vi /etc/sysconfig/network

networking=yes

networking_ipv6=yes

hostname=localhost.localdomain

gateway=192.168.100.1

修改dns

# vi /etc/resolv.conf

nameserver 8.8.8.8 #google網域名稱伺服器

nameserver 8.8.4.4 #google網域名稱伺服器

修改網路配置以後記得重啟網絡卡服務 service network restart

複製虛擬機器以後的問題

/etc/udev/rules.d/70-persistent-net.rules 這個檔案繫結了mac

複製虛擬機器以後網絡卡的 mac位址變了 所以在配置檔案ifcfg-eth0裡面把hwaddr刪掉

再把/etc/udev/rules.d/70-persistent-net.rules刪掉後重啟虛擬機器

CentOS下修改IP位址

ifconfig命令 第乙個網絡卡名字 eno1 按insert鍵,上下游標鍵移動,進行修改 幾個重要的修改字段 bootproto 設定為靜態ip static ipaddr 設定ip位址 netmask 設定子網掩碼 gateway 設定閘道器 dns1 設定首選dns伺服器 dns2 設定備用...

CentOS 修改IP位址, DNS, 閘道器

一 centos 修改ip位址 修改對應網絡卡的ip位址的配置檔案 vi etc sysconfig network scripts ifcfg eth0 修改以下內容 device eth0 描述網絡卡對應的裝置別名,例如ifcfg eth0的檔案中它為eth0 bootproto static ...

CentOS 修改IP位址, DNS, 閘道器

一 centos 修改ip位址 修改對應網絡卡的ip位址的配置檔案 vi etc sysconfig network scripts ifcfg eth0 修改以下內容 device eth0 描述網絡卡對應的裝置別名,例如ifcfg eth0的檔案中它為eth0 bootproto static ...