Linux(RHEL6) 網絡配置

1. ifconfig命令及其附加選項

    -a:顯示所有接口信息

    -s:顯示每個接口的摘要信息,與netstat -i 命令的執行結果一樣

    [init]: ifconfig eth0 :顯示指定接口信息

    up:ifconfig eth0 up:激活eth0

    down:ifconfig eth0 down:停掉eth0

    netmask:給一個接口設定網絡掩碼:ifconfig eth0 netmask 255.255.255.0

    broadcast:設置指定接口的廣播地址:ifconfig eth0 broadcast 192.168.0.255

    [addr]:ifconfig eth0 192.168.0.100 :設置接口的IP地址

2. 重啓網絡

    service network restart

3. 常見故障

    (1)網卡工作不正常

    檢測網卡:lsmod

    PingIP:ping -c 5 192.168.1.168

    (2)DNS設置問題

    vi /etc.resolv.conf

    (3)默認路由設置問題

    默認的Gateway:192.168.1.1

    route del default #刪除原有的默認路由

    route add default gw 192.168.1.1 #將默認路由指向網關

    (4)修改網卡的硬件地址

    ifconfig eth0 hw ether 00:01:02:03:04:05 #ether說明網卡類型,並將網卡的物理地址改爲:01:02:...:05

    (5)一戰網卡綁定多個Ip地址

    ifconfig eth0:0 192.168.0.253

    ifconfig eth0:1 192.168.0.252

    若希望系統自定綁定,則需要將浙西額命令寫到/etc/rc.d/rc.local中或在/etc/sysconfig/network-scripts目錄中,

    將ifcfg-eth0:0、ifcfg-eth0:1等,並做以下修改:

    DEVICE=eth0:0[1]

    IPADDR=192.168.0.253[252]  

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章