Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> Linux技術

Linux 網卡配置參數詳解

Linux 各發行版設定網路的方式大同小異。本文以 RHEL、CentOS、Ubuntu 與 SUSE 為例,說明常見網卡設定檔與參數。

CentOS 與 RHEL

主要設定檔包含 /etc/sysconfig/network、/etc/sysconfig/network-scripts/ifcfg-eth0、/etc/resolv.conf 與 /etc/hosts。

ifcfg-eth0 常見參數有 DEVICE、HWADDR、TYPE、UUID、ONBOOT、NM_CONTROLLED、BOOTPROTO、IPADDR、NETMASK、GATEWAY、USERCTL、PEERDNS 與 IPV6INIT。

修改後可執行 /etc/init.d/network restart 重啟網路。若使用 ifconfig 手動設定,重啟網路後會失效。

Ubuntu 12.04

可使用 lshw -c network 查看 MAC,並編輯 /etc/network/interfaces 設定 auto eth0、iface eth0 inet static、address、netmask 與 gateway。

重啟網路:

/etc/init.d/networking restart

SUSE 11

可查看 /etc/udev/rules.d/70-persistent-net.rules 取得 MAC,並修改 /etc/sysconfig/network/ifcfg-eth0,設定 BOOTPROTO、IPADDR、NETMASK、STARTMODE 等參數。

完成後執行 /etc/init.d/network restart。

Copyright © Linux教程網 All Rights Reserved