Linux網路設定

2022-03-09 23:13:31 字數 1240 閱讀 9289

檢視網路狀態命令 ifconfig 

啟動eth0網絡卡 ifup eth0

可以單獨檢視某一塊網絡卡的資訊 ifconfig eth0

修改網絡卡ip位址,linux所有裝置都是以檔案存在的,我們要找到網絡卡的配置檔案,linux預設網絡卡配置檔案在/etc/sysconfig/network-scripts/下,命名的名稱一般為:ifcfg-eth0 ifcfg-eth1,eth0表示第一塊網絡卡,eth1表示第二塊網絡卡,依次類推,一般dell r720標配有4塊千兆網絡卡。

修改網絡卡的ip,可以使用命令vi /etc/sysconfig/network-scripts/ifcfg-eth0 預設是dhcp獲取的ip,預設配置如下:

device=eth0  //物理裝置名

hwaddr=00:0c:29:12:4d:30  

type=ethernet

onboot=yes    //重啟網絡卡是否啟用裝置

bootproto=dhcp //ip位址的獲取方式

如果是靜態的ip,ifcfg-eth0網絡卡配置內容如下:

device=eth0

hwaddr=00:0c:29:12:4d:30

type=ethernet

onboot=yes

bootproto=static

ipaddr=192.168.1.1

netmask=255.255.255.0

gateway=192.168.1.254

網絡卡配置完成重啟網絡卡服務才能生效,命令

/etc/init.d/network restart

如果要訪問**網域名稱,需要配置dns,dns配置檔案

vi /etc/resolv.conf

nameserver 202.103.24.68

試著ping一下**檢視是否能成功訪問

如何切換到圖形介面

linux有預設的級別,1是單使用者模式,3是字元介面,5是圖形介面,

字元介面檢視級別命令

runlevel

進入圖形介面命令,前提是linux系統已經安裝了圖形介面的程式

init 5 

如何遠端管理linux,要想中文正常顯示,開啟會話選項,外觀中的字元編碼改為utf-8

linux網路設定

size large linux ip 設定 修改ip位址 即時生效 ifconfig eth0 192.168.1.102 netmask 255.255.255.0 啟動生效 修改 etc sysconfig network scripts ifcfg eth0 加入ipaddr 192.168...

Linux網路設定

ifconfig 檢視所有活動的網路介面資訊 ifconfig 網路介面 hostname 檢視主機名稱 hostname 主機名 修改主機名稱 bash route 檢視路由表條目 route n 將路由記錄中的位址資訊顯示為數字形式 netstat 檢視網路連線情況 netstat 選項 通過n...

Linux網路設定

檢視所有活動的網路介面資訊 執行ifconfig命令 檢視指定網路介面資訊 ifconfig 網路介面 ifconfig ens33 設定網路介面的ip位址 子網掩碼 ifconfig 網路介面 ip位址 netmask 子網掩碼 ifconfig 網路介面 ip 位址 子網掩碼長度 禁用或者重新啟...