ubuntu 的網路配置

2021-09-30 05:34:23 字數 1917 閱讀 2785

重啟網路命令:sudo /etc/init.d/networking restart

修改網路配置:sudo vi /etc/network/inte***ces 

具體檔案參考:

# /etc/network/inte***ces -- configuration file for ifup(8), ifdown(8)

# the loopback inte***ce

auto lo

iface lo inet loopback

# the first network card - this entry was created during the debian installation

# (network, broadcast and gateway are optional)

auto eth0

iface eth0 inet static

address 192.168.1.1

netmask 255.255.255.0

network 192.168.1.0

broadcast 192.168.1.255

# gateway 192.168.1.1

# name 乙太網區域網網絡卡

auto eth0:0

iface eth0:0 inet static

address 192.168.1.2

netmask 255.255.255.0

network 192.168.1.0

broadcast 192.168.1.255

gateway 192.168.1.1

# /etc/network/inte***ces -- configuration file for ifup(8), ifdown(8)

# the loopback inte***ce

auto lo

iface lo inet loopback

# the first network card - this entry was created during the debian installation

# (network, broadcast and gateway are optional)

auto eth0

iface eth0 inet dhcp

臨時修改mark

sudo ifconfig

sudo ifconfig eth0 down

sudo ifconfig eth0 hw ether 00:1b:38:c0:c5:40

sudo ifconfig eth0 up

sudo /etc/init.d/networking restart

關閉和啟動網絡卡

sudo ifdown eth0

sudo ifup eth0

有可能需要配置網域名稱解析 /etc/resolve.conf檔案

參考:該檔案是dns網域名稱解析的配置檔案,它的格式很簡單,每行以乙個關鍵字開頭,後接配置引數。resolv.conf的關鍵字主要有四個,分別是:

nameserver   #定義dns伺服器的ip位址

domain #定義本地網域名稱

search #定義域名的搜尋列表

sortlist #對返回的網域名稱進行排序

/etc/resolv.conf的乙個示例:
domain ringkee.com
search www.ringkee.com ringkee.com

nameserver 202.96.128.86

nameserver 202.96.128.166

最主要是nameserver關鍵字,如果沒指定nameserver就找不到dns伺服器,其它關鍵字是可選的

Ubuntu的網路配置

1.使用命令檢視網絡卡基本資訊 ifconfig 如要配置電腦的實體地址是00 11 22 33 44 55 則 sudo ifconfig eth0 hw ether 00 11 22 33 44 55 4.禁止網絡卡 sudo ifconfig eth0 down 使能網絡卡 sudo ifco...

Ubuntu 的網路配置

1 安裝vim full版本,ubuntu預設安裝的是vim tiny版本 sudo apt get remove vim common sudo apt get install vim 為了防止退格鍵 方向鍵在vi編輯模式下失效2 修改ubuntu的 etc network inte ces 檔案...

ubuntu 網路配置

進入網路配置檔案 sudo vi etc network inte ces 在這裡你應該會看到如下內容 auth lo iface lo inet loopback 這個正是 lo回環,我需要讓這台執行 ubuntu server 的機子通過 dhcp 獲得ip 來加入網路,那麼我只需要在上面的 l...