Linux 系統設定靜態 IP

2021-08-24 18:48:33 字數 971 閱讀 1436

(1) 直觀的方式是,如你使用fedora 系統,在命令列下輸入:setup ,根據嚮導輸入靜態ip即可,可參考我的文章《vmware workstation搭建nat測試環境》

(2) 修改配置檔案,命令列下輸入

vim /etc/sysconfig/network-script s/ifcfg-eth0

device=eth0

onboot=yes

bootproto=static

ipaddr=192.168.0.3

netmask=255.255.255.0

gateway=192.168.0.1

device=eth0<--裝置

onboot=yes<--是否自動啟動

bootproto=static<--是否使用靜態ip

ipaddr=***.***.***.xx<--你的ip

netmask=255.255.255.0<--你的子網掩碼

gateway=192.168.0.1 <--你的閘道器

使ip位址生效:

/sbin/ifdown eth0

/sbin/ifup eth0

配置dns解析

echo "nameserver 211.98.1.28">> /etc/resolv.conf

通知閘道器更新資訊:

/etc/init.d/network restart

dns就是domain name system,它能夠把形如www.21php.com這樣的網域名稱轉換為211.152.50.35這樣的ip位址;沒有dns,瀏覽21php.com 這個**時,就必須用211.152.50.35這麼難記的數字來訪問。提供dns服務的就是dns伺服器。dns伺服器可以分為三種,快取記憶體伺服器 (cache-only server)、主伺服器(primary name server)、輔助伺服器(second name server)。

linux設定靜態ip

安裝linux之後,一般都會設定nat聯網模式,此時沒有為centos分配ip位址為系統分配ip有兩種方法。type ethernet hwaddr 00 0c 29 3f 79 46 nm controlled yes bootproto static name ens33 uuid 37566c...

linux靜態ip設定

vim etc sysconfig network scripts ifcfg enp1s0修改為以下內容 type ethernet proxy method none browser only no name enp1s0 uuid 2f66bc1d 3916 46c9 aedd 30cc5dc...

Linux 設定靜態IP

ubuntu下修改靜態ip 開啟 etc network inte ces檔案,修改為以下內容 auto eth0 iface eth0 inet static address 172.30.1.network 255.255.0.0 gateway 172.30.1.1 新增dns位址,開啟 et...