linux下修改ip位址

2021-04-12 15:50:14 字數 808 閱讀 7653

os: fc2

nic: eth0

host name: fc2

ip: 192.168.0.20/24

default gateway: 192.168.0.254

直接執行:#setup

然後會彈出選項視窗,設定一下就可以了

或者修改配置檔案

/etc/sysconfig/network-scripts/ 下有配置檔案

比如檔案:ifcfg-eth0  代表是乙太網實際網絡卡0的配置檔案

比如檔案:ifcfg-eth0:1  代表是乙太網實際網絡卡0的配置檔案

網域名稱伺服器配置檔案:/etc/ resolv.conf

* 修改ip位址

即時生效:

# ifconfig eth0 192.168.0.20 netmask 255.255.255.0

啟動生效:

修改/etc/sysconfig/network-scripts/ifcfg-eth0

* 修改default gateway

即時生效:

# route add default gw 192.168.0.254

啟動生效:

修改/etc/sysconfig/network-scripts/ifcfg-eth0

* 修改dns

修改/etc/resolv.conf

修改後可即時生效,啟動同樣有效

* 修改host name

即時生效:

# hostname fc2

啟動生效:

修改/etc/sysconfig/network

linux下修改IP位址

linux修改ip和dns 以red hat enterprise linux 5.2為例 1 最常用的給網絡卡配置ip的命令為 ifconfig eth0 192.168.0.1 netmask 255.255.255.0 up 說明 eth0是第乙個網絡卡,其他依次為eth1,eth 192.1...

linux下修改ip位址

linux修改ip和dns 以red hat enterprise linux 5.2為例 1 最常用的給網絡卡配置ip的命令為 ifconfig eth0 192.168.0.1 netmask 255.255.255.0 up 說明 eth0是第乙個網絡卡,其他依次為eth1,eth 192.1...

Linux下如何修改IP位址

a 修改ip位址 即時生效 ifconfig eth0 192.168.0.20 netmask 255.255.255.0 啟動生效 修改 etc sysconfig network s ifcfg eth0 b 修改default gateway 即時生效 route add default g...