Ubuntu下配置靜態位址

2021-09-01 14:02:55 字數 799 閱讀 8016

首先設定ip

$sudo gedit /etc/network/inte***ces

auto lo

iface lo inet loopback           

auto eth0 

iface eth0 inet static 

address 192.168.1.99

netmask 255.255.255.0 

gateway 192.168.1.1

儲存,並關閉gedit。

這樣,ip並沒有立即生效。需要執行

$sudo /etc/init.d/networking restart

這時候就能ping到區域網中的電腦了。但是上不了internet,是因為沒有設定dns的原因。dns資訊儲存在/etc/resolv.conf中,一旦更改,立即生效。

這裡是進行dns伺服器的配置

$sudo gedit /etc/resolv.conf

nameserver 192.168.2.43

nameserver 192.168.2.6

儲存並關閉,現在就可以上網了。

附網絡卡設定相關命令:

檢視網絡卡資訊: ifconfig

---------------------------------------

根據以上步驟的設定,只是linux系統本身的配置。

筆者的路由器是開啟了dhcp分配ip功能的,所以還要再多做乙個步驟。

將192.168.1.99這個位址分配給虛擬機器的mac位址,然後設定成靜態位址。

然後重啟路由,一切ok

ubuntu 靜態位址配置

1.單網絡卡配單ip 普遍 vi etc network inte ce auto eth0 iface eth0 inet static address ip netmask 子網掩碼 gateway 閘道器 2.單網絡卡雙ip 情況較少,多用於區分服務或者安全隱藏 vi etc network ...

配置Ubuntu靜態位址

右上角有乙個wifi或者上下箭頭的圖示 選擇這個選項edit contions ipv4 manual 手動方式 ip 192.168.0.210 netmask 255.255.255.0 gatewayip 192.168.0.1 dns 8.8.8.8 sudo service network...

Ubuntu下靜態IP位址的配置

linux下靜態ip位址的配置 設定ip sudo vi etc network inte ces auto lo iface lo inet loopback auto eth0 iface eth0 inet static address 192.168.1.221 netmask 255.25...