網路 linux網路配置

2021-06-09 18:29:29 字數 1165 閱讀 8947

zlm@ubuntu:~$ sudo ifconfig eth0 192.168.1.109 netmask 255.255.255.0 broadcast 192.168.1.255 

zlm@ubuntu:~$ sudo route   add|del   default   gw   192.168.1.1 新增刪除閘道器

這是臨時的重啟之後就不行了

sudo vi /etc/network/inte***ces

# the primary network inte***ce - use dhcp to find our address

auto eth0

iface eth0 inet dhcp   //指定為dhcp

在輸入這幾行後,你需要通過以下命令重新啟動你的網路裝置:

sudo /etc/init.d/networking restart

為網絡卡配置靜態ip

sudo vi /etc/network/inte***ces

# the primary network inte***ce

auto eth0

iface eth0 inet static   //指定為static

address 192.168.1.109   //ip位址

gateway 192.168.1.1   //閘道器

netmask 255.255.255.0   //子網掩碼

broadcast 192.168.3.255   //廣播

在輸入這幾行後,你需要通過以下命令重新啟動你的網路裝置:

sudo /etc/init.d/networking restart

設定dns

sudo vi /etc/resolv.conf

# dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)

#     do not edit this file by hand -- your changes will be overwritten

nameserver 202.106.195.68

nameserver 202.106.196.115                           

linux網路管理 Linux網路配置

1.1 linux配置ip位址 1 ifconfig命令臨時配置ip位址 能不能自動獲取ip位址和dns位址,要看有沒有dhcp伺服器 win10上,輸入ipconfig all 會看到是否有dhcp伺服器 ifconfig命令 對此命令更加詳細的解說 傳送門 2 setup工具永久配置ip位址 r...

linux配置 網路配置

ip位址,子網掩碼,閘道器 設定ip位址,子網掩碼並啟用 ifconfig eth0 10.192.77.250 netmask 255.255.255.0 up 注 ip,掩碼,閘道器都設定到 etc sysconfig network scripts ifcfg eth0裡面了。設定多ip 可以...

linux網路配置

以eth0為例 1.以dhcp方式配置網絡卡 編輯檔案 etc network inte ces sudo vi etc network inte ces 並用下面的行來替換有關eth0的行 the primary network inte ce use dhcp to find our addre...