How do we secure the address of the source of the packages leaving the interface?



  • On eth0, a number of ips rise. Let's pass file /etc/network/interfaces:

    auto eth0
    iface eth0 inet static
        address 100.100.100.100
        netmask 255.255.255.0
    auto eth0:1
    iface eth0:1 inet static
        address 100.100.100.101
        netmask 255.255.255.0
    auto eth0:2
    iface eth0:2 inet static
        address 100.100.100.102
        netmask 255.255.255.0
    

    If you look at the routing table, you see the following records.

    $ ip route show
    default via 100.100.100.1 dev eth0
    100.100.100.0/24 dev eth0  proto kernel  scope link  src 100.100.100.102
    

    The challenge is that always meaning src 100.100.100.102 It was the ip I'd say (and it was permanent). I can do it manually through the team. ipbut it'll only be until the first reboot of the server or the command call. service networking reload

    How can this be done literate, given that the number of ips can be more than 100 on one interface?

    And if you set up a routing table, again through the team. ip But it only exists before the first reboot.



  • eth0:1 eth0:2

    n. network interface aliases programme subsystem linux 15-16 years ago, I've been doing a normal configuration without this heavy legacy, but if you want, just finish the configuration. alias-ami

    The challenge is that I want the meaning of src 100.100.100.102 to be that ip I will tell you (and it was permanent).

    And point it out clearly.

    auto eth0
    iface eth0 inet static
    address 100.100.100.100
    netmask 255.255.255.0
    up ip a a 100.100.100.101/24 dev $IFACE
    up ip a a 100.100.100.102/24 dev $IFACE
    up ip r c 100.100.100.0/24 dev $IFACE src 100.100.100.102
    

    Reductions used (may be written and completely, just so short):

    • ip a a = ip address add
    • ip r c = ip route change

    on " Complementing alias-ami" .

    If they're so necessary, it's easier to tell them. alias- (in programme terminology) ip - marks, labels(a) Direct arguments of the programme ip:

    ip a a ... label $IFACE:0
    



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2