本文共 2150 字,大约阅读时间需要 7 分钟。
system-config-network
ifconfig eth0 192.168.0.10 netmask 255.255.255.0orip addr add 192.168.0.10 dev eth0
ifcfg-eth0,ifcfg-eth1,ifcfg-eth2 ... ifcfg-eth(n)
[root@development httpd]# cat /etc/sysconfig/network-scripts/ifcfg-eth0# Broadcom Corporation NetLink BCM5784M Gigabit Ethernet PCIeDEVICE=eth0BOOTPROTO=staticBROADCAST=192.168.3.255HWADDR=00:25:64:A3:59:BFIPADDR=192.168.3.40IPV6INIT=yesIPV6_AUTOCONF=yesNETMASK=255.255.255.0NETWORK=192.168.3.0ONBOOT=yes
eth0:1
[root@development httpd]# cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0:1[root@development httpd]# vi /etc/sysconfig/network-scripts/ifcfg-eth0:1# Broadcom Corporation NetLink BCM5784M Gigabit Ethernet PCIeDEVICE=eth0:1BOOTPROTO=staticBROADCAST=192.168.3.255HWADDR=00:25:64:A3:59:BFIPADDR=192.168.3.41IPV6INIT=yesIPV6_AUTOCONF=yesNETMASK=255.255.255.0NETWORK=192.168.3.0ONBOOT=yes
reload network
[root@development ~]# /etc/init.d/network reloadShutting down interface eth0: [ OK ]Shutting down loopback interface: [ OK ]Bringing up loopback interface: [ OK ]Bringing up interface eth0:
[root@development ~]# cat /etc/sysconfig/networkNETWORKING=yesNETWORKING_IPV6=yesHOSTNAME=development.domain.orgGATEWAY=192.168.3.1
cat >> /etc/modprobe.d/bonding.conf </etc/sysconfig/network-scripts/ifcfg-eth0 < /etc/sysconfig/network-scripts/ifcfg-eth1 < /etc/sysconfig/network-scripts/ifcfg-bond0 < > /etc/rc.local <
Linux 系统4个物理网卡的名称则分别为eth0,eth1,eth2,eth3。我们将四个网口桥接到br0端口。
你可以这样理解 vlan 2, vlan ip 192.168.0.1,然后将4个接口划分到vlan2, 这时这4个接口可以通过vlan 2访问其他用户。我只是做了一个比喻,让你能够理解。
# brctl addbr br0# brctl addif br0 eth0# brctl addif br0 eth1# brctl addif br0 eth2# brctl addif br0 eth3# ifconfig eth0 0.0.0.0# ifconfig eth1 0.0.0.0# ifconfig eth2 0.0.0.0# ifconfig eth3 0.0.0.0# ifconfig br0 192.168.0.1
# nmtui# nmtui edit eno16777736# nmtui connect eno16777736
原文出处:Netkiller 系列 手札
本文作者:陈景峯 转载请与作者联系,同时请务必标明文章原始出处和作者信息及本声明。