• [原]RHEL6网络配置


    一.非桥接模式:

    配置:/etc/sysconfig/network-scripts/ifcfg-eth0,如下:

    DEVICE="eth0"
    HWADDR="11:11:11:11:11:11"
    NM_CONTROLLED="yes"
    ONBOOT="yes"

    BOOTPROTO=static
    IPADDR=192.168.77.103
    NETMASK=255.255.255.0
    GATEWAY=192.168.77.1

    二.桥接模式:

    1.配置/etc/sysconfig/network-scripts/ifcfg-eth0,如下:

    DEVICE="eth0"
    TYPE=ethernet
    HWADDR="11:11:11:11:11:11"
    NM_CONTROLLED="no"
    ONBOOT="yes"

    #BOOTPROTO=static
    #IPADDR=192.168.77.103
    #NETMASK=255.255.255.0
    #GATEWAY=192.168.77.1
    BRIDGE=br0

    2.配置/etc/sysconfig/network-scripts/ifcfg-br0,如下:


    DEVICE="br0"
    TYPE=Bridge

    BOOTPROTO=static
    IPADDR=192.168.77.103
    NETMASK=255.255.255.0
    #NETWORK=192.168.1.0
    GATEWAY=192.168.77.1

    #HWADDR="11:11:11:11:11:11"
    #NM_CONTROLLED="yes"
    ONBOOT="yes"
    NM_CONTROLLED=no

    3.[可略]配置/etc/sysconfig/network-scripts/ifcfg-eth1,如下:
    DEVICE="eth1"
    HWADDR="78:2B:CB:65:25:EC"
    NM_CONTROLLED="yes"
    ONBOOT="yes"

    BOOTPROTO=static
    IPADDR=10.10.10.103
    #netmask=255.255.255.0
    #GATEWAY=10.10.10.1

    4.修改/etc/sysctl.conf 文件,并增加如下:

    net.bridge.bridge-nf-call-ip6tables = 0
    net.bridge.bridge-nf-call-iptables = 0
    net.bridge.bridge-nf-call-arptables = 0
    net.bridge.bridge-nf-filter-vlan-tagged=0
    保存退出。

    5.重启网络: /etc/init.d/network restart

    三.查询验证:

    1.brctl show:

    bridge name     bridge id               STP enabled     interfaces
    br0             8000.782bcb6525eb       no              eth0
                                                            vnet0
    virbr0          8000.000000000000       yes

    2.ifconfig查询结果类似,则表明br0桥接配置成功:

    [root@compute3RHEL6 network-scripts]# ifconfig
    br0       Link encap:Ethernet  HWaddr 11:11:11:11:11:11
              inet addr:192.168.77.103  Bcast:192.168.77.255  Mask:255.255.255.0
              inet6 addr: fe80::1111:1111:1111:1111/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:14328578 errors:0 dropped:0 overruns:0 frame:0
              TX packets:4650570 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0
              RX bytes:4459176095 (4.1 GiB)  TX bytes:320844851 (305.9 MiB)

    eth0      Link encap:Ethernet  HWaddr 11:11:11:11:11:11
              inet6 addr: fe80::7a2b:cbff:fe65:25eb/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:14338630 errors:0 dropped:0 overruns:0 frame:0
              TX packets:4651391 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000
              RX bytes:4718080971 (4.3 GiB)  TX bytes:362095405 (345.3 MiB)
              Interrupt:36 Memory:da000000-da012800

    eth1      Link encap:Ethernet  HWaddr 78:2B:CB:65:25:EC
              inet6 addr: 1111::1111:1111:1111:25ec/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:32644 errors:0 dropped:0 overruns:0 frame:0
              TX packets:445 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000
              RX bytes:2548629 (2.4 MiB)  TX bytes:41490 (40.5 KiB)
              Interrupt:48 Memory:dc000000-dc012800

    lo        Link encap:Local Loopback
              inet addr:127.0.0.1  Mask:255.0.0.0
              inet6 addr: ::1/128 Scope:Host
              UP LOOPBACK RUNNING  MTU:16436  Metric:1
              RX packets:1028 errors:0 dropped:0 overruns:0 frame:0
              TX packets:1028 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0
              RX bytes:1180221 (1.1 MiB)  TX bytes:1180221 (1.1 MiB)

    virbr0    Link encap:Ethernet  HWaddr 11:11:11:11:11:11
              inet addr:192.168.122.1  Bcast:192.168.122.255  Mask:255.255.255.0
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:31 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0
              RX bytes:0 (0.0 b)  TX bytes:4276 (4.1 KiB)

    vnet0     Link encap:Ethernet  HWaddr 11:11:11:11:11:11
              inet6 addr: 1111::1111:11:1111:1111/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:70 errors:0 dropped:0 overruns:0 frame:0
              TX packets:2062 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:500
              RX bytes:12016 (11.7 KiB)  TX bytes:178631 (174.4 KiB)

    赠人玫瑰
    手留余香

    我们曾如此渴望命运的波澜,到最后才发现:人生最曼妙的风景,竟是内心的淡定与从容……我们曾如此期盼外界的认可,到最后才知道:世界是自己的,与他人毫无关系!-杨绛先生

    如果,您认为阅读这篇博客让您有些收获,不妨点击一下右下角的推荐按钮。
    如果,您希望更容易地发现我的新博客,不妨点击一下绿色通道的关注我

  • 相关阅读:
    工厂模式
    将博客搬至CSDN
    网络安全-跨站脚本攻击XSS(Cross-Site Scripting)
    Linux 权限
    git常用的语句
    git代码提交与克隆
    git学习
    Mybatis常见问题
    关于集合常见的问题
    远程连接(加密验证问题解决)
  • 原文地址:https://www.cnblogs.com/haochuang/p/2366885.html
Copyright © 2020-2023  润新知