1、TCP/IP 網路設定檔
2、使用命令配置網路
3、網路診斷工具
TCP/IP 網路設定檔
IP設定檔:/etc/sysconfig/network-scripts/ifcfg-eth0
網管設定檔:/etc/sysconfig/network
網域名稱解析:/etc/host.conf
主機配置:/etc/hosts
路由配置:/etc/resolv.conf
服務連接埠配置:/etc/services
網路介面啟動指令碼:
[root@asm ~]# more /etc/sysconfig/network-scripts/ifcfg-eth0
# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth0
BOOTPROTO=static
BROADCAST=192.168.8.255
HWADDR=00:0C:29:8B:86:65
IPADDR=192.168.8.160
NETMASK=255.255.255.0
NETWORK=192.168.8.0
ONBOOT=yes
[root@asm ~]# more /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=asm.Oracle.com
GATEWAY=192.168.8.1
/etc/hosts
該檔案是系統本地的主機名稱解析資料庫
[root@asm ~]# more /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
192.168.8.160 asm.oracle.com asm
/etc/host.conf 檔案用於指定如何解析主機名稱,可用選項:
order:設定主機名稱解析的可用方法及順序,可用方法包括hosts(使用/etc/hosts檔案進行解析)、bind
(使用DNS伺服器解析)、nis(使用網路資訊服務NIS解析)
multi:設定是否從 /etc/hosts 檔案中返回主機的多個 IP 位址,取值為 on/off
/etc/resolv.conf 檔案是 DNS (DNS網域名稱服務 (DNS)的用戶端設定檔):
[root@asm ~]# more /etc/resolv.conf
nameserver 192.168.8.11
search oracle.com
domain oracle.com
/etc/services 設定網路服務預設使用的 TCP 或 UDP 連接埠
使用命令列工具或GUI工具配置 Linux 網路:
[root@asm ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:8B:86:65
inet addr:192.168.8.160 Bcast:192.168.8.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:23894 errors:0 dropped:0 overruns:0 frame:0
TX packets:1864 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1708719 (1.6 MiB) TX bytes:309503 (302.2 KiB)
Interrupt:75 Base address:0x2000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:18747 errors:0 dropped:0 overruns:0 frame:0
TX packets:18747 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1215290 (1.1 MiB) TX bytes:1215290 (1.1 MiB)
[root@asm ~]# ifconfig eth0 192.168.8.161 netnask 255.255.255.0 up
[root@asm ~]# ifconfig eth0 192.168.8.160 netnask 255.255.255.0 up
[root@asm ~]# ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:0C:29:8B:86:65
inet addr:192.168.8.160 Bcast:192.168.8.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:24260 errors:0 dropped:0 overruns:0 frame:0
TX packets:2001 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1736070 (1.6 MiB) TX bytes:327830 (320.1 KiB)
Interrupt:75 Base address:0x2000
修改設定檔重啟網卡也可修改IP地址:
vi /etc/sysconfig/network-scripts/ifcfg-eth0
service network restart
vi /etc/sysconfig/network
vi /etc/resolv.conf