• CentOS双网卡双IP设置


    网络环境: 两个IP地址,192.168.0.10和10.10.30.2,掩码是255.255.255.0,这两个子网的网关地址分别是192.168.0.1和10.10.30.1。

    1. 为网卡eth0配置ip地址192.168.0.10,为网卡eth1配置ip地址为10.10.30.2配置文件为:
    /etc/sysconfig/network-scripts/ifcfg-eth0
    /etc/sysconfig/network-scripts/ifcfg-eth1

    2. 配置默认网关为任意一个。这个默认网关,决定了系统主动去使用网络时,使用的接口。

    配置文件:/etc/sysconfig/network

    3. 编辑路由表

    修改/etc/iproute2/rt_tables,添加内容:

    252   net2
    251  net3

    #/etc/rc.local添加原路返回路由

    ip route flush table net2
    ip route add default via 192.168.0.1 dev eth0 src 192.168.0.10 table net2
    ip rule add from 192.168.0.10 table net2

    ip route flush table net3
    ip route add default via 10.10.30.1 dev eth1 src 10.10.30.2 table net3
    ip rule add from 10.10.30.2 table net3

  • 相关阅读:
    shift
    start
    exit
    call
    goto
    Activity生命周期(二)
    color 和 mode
    pause 和 title
    day 4 飞机大战-面向对象
    day 3 创建窗口,移动-函数版
  • 原文地址:https://www.cnblogs.com/lubing666666/p/4389443.html
Copyright © 2020-2023  润新知