【Linux】Linux網路配置基礎1 網路相關命令與網路卡配置檔案
Linux網路配置基礎1
網路相關命令與網路卡配置檔案
OS:Red Hat Enterprise Linux 6.4

1 ifconfig 檢視/設定網路卡
ifconfig 檢視所有活動網路卡資訊
ifconfig -a 檢視所有網路卡資訊
ifconfig eth0 檢視具體網路卡資訊
ifconfig eth0 up/down 啟用/禁用網路卡
ifup/ifdown eth0 啟用/禁用網路卡(重新讀取配置檔案)
[root@rhel64 ~]# ifconfig

檢視具體網路卡資訊
[root@rhel64 ~]# ifconfig eth0

臨時設定eth0網路卡子介面ip,子網路卡ip須使用靜態配置。
[root@rhel64 ~]# ifconfig eth0:0 192.168.7.101
[root@rhel64 ~]# ifconfig

[root@rhel64 ~]# ifconfig eth0:0 down
[root@rhel64 ~]# ifconfig

2 ip、ethtool 檢視網路卡配置、屬性
[root@rhel64 ~]# ip

檢視網路介面配置情況
[root@rhel64 ~]# ip addr
[root@rhel64 ~]# ip addr show eth0

檢視網路介面屬性資訊
[root@rhel64 ~]# ethtool eth0

3 ping 測試網路通訊
[root@rhel64 ~]# ping 192.168.6.6 -c 4

4 route -n 檢視路由資訊
[root@rhel64 ~]# route -n
[root@rhel64 ~]# ip route

如果需手動指定具體路由,可編輯修改配置檔案
/etc/sysconfig/network-scripts/route-eth0
5 traceroute 檢視主機間路由
測試從當前主機到目標主機間經過的網路節點
[root@rhel64 ~]# traceroute 192.168.6.6

windows中對應命令tracert

6 hostname 檢視主機名
[root@rhel64 ~]# hostname

hostname命令也可以用來臨時設定主機名,當前有效,重啟後恢復配置檔案中值
7 netstat 檢視網路連線狀態
[root@rhel64 ~]# netstat --help

[root@rhel64 ~]# netstat -lntup

[root@rhel64 ~]# netstat -antup

8 /etc/sysconfig/network
全域性配置檔案
[root@rhel64 ~]# cat /etc/sysconfig/network

NETWORKING 全域性網路開關
HOSTNAME 主機名
GATEWAY 全域性閘道器配置,多個網路卡時可在具體網路卡配置檔案指定
9 具體網路卡配置檔案
[root@rhel64 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE 網路卡名稱 要與配置檔名中一致
TYPE=Ethernet 乙太網
ONBOOT=yes 重啟作業系統後啟用網路卡
BOOTPROTO none 或者static是靜態設定ip;dhcp是自動獲取
IPADDR ip地址
GATEWAY 閘道器 預設路由
PREFIX 子網掩碼,或使用NETMASK=255.255.255.0
10 本地主機名解析 /etc/hosts
儲存主機名與IP地址的對映記錄
[root@rhel64 ~]# cat /etc/hosts

[root@rhel64 ~]# vi /etc/hosts

[root@rhel64 ~]# ping rhel64 -c2

win7中也有對應檔案

11 網路配置總結


呂星昊
2016.1.18
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29475508/viewspace-1978184/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 『學了就忘』Linux基礎命令 — 34、配置網路相關命令Linux
- Linux網路配置基礎Linux
- Linux網路相關命令Linux
- 【linux】命令-網路相關Linux
- Linux系統網路檔案配置Linux
- Linux(08):網路配置檔案——其它Linux
- linux網路卡配置檔案詳解Linux
- Linux(07):網路配置檔案——ifcfg-*Linux
- linux網路配置Linux
- Linux|網路配置Linux
- 【Linux】(小白向)詳解VirtualBox網路配置-配置Linux網路Linux
- Linux網路卡配置檔案 引數詳解Linux
- linux之網路配置Linux
- 配置Linux的網路Linux
- 【Linux】Linux網路配置基礎5 RHEL6 作業系統使用virtualbox NAT網路Linux作業系統
- 快速上手Linux核心命令(八):網路相關命令Linux
- Linux centOS如何配置網路LinuxCentOS
- Linux網路服務 ------------------ 瞭解網路設定與學習相關操作命令Linux
- Linux 7 配置網路卡(nmcli)Linux
- kali網路卡配置檔案
- Linux網路管理基礎Linux
- Linux伺服器---網路配置Linux伺服器
- Linux系統下網路配置Linux
- Linux 雙網路卡雙IP配置Linux
- Linux基礎之網路管理Linux
- Linux基礎命令---netstat顯示網路狀態Linux
- 基礎的 Linux 網路命令,你值得擁有Linux
- Linux 下網路介面卡配置Linux
- Linux 筆記分享十八:網路配置Linux筆記
- [Linux] Ubuntu 18 LTS netplan 網路配置LinuxUbuntu
- **Linux 配置系統網路(動態)**Linux
- Linux虛擬機器網路配置Linux虛擬機
- linux-網路命令Linux
- docker 運用 gpu 網路相關配置DockerGPU
- Docker網路配置基礎知識Docker
- Linux網路命令與指令碼使用Linux指令碼
- Linux基礎命令---ntpdate網路時間伺服器Linux伺服器
- 幾種Linux網路配置工具的使用Linux
- linux系統配置及相關檔案Linux