Priority IP

Fabio T. Leitao fabio.tleitao at gmail.com
Wed Oct 14 23:33:26 UTC 2009


I think you you want to ensure the network trafic gets from eth2 using the
eth2 IP address, and not some of the virtual devices (e.g. eth2:2) ... You
could try to use a /etc/network/interfaces file like this (it works for me
as default from the boot):
auto eth2
   iface eth2 inet static
   address aaa.bb.157.50
   network aaa.bb.157.0
   netmask 255.255.255.248
   up ip addr add aaa.bb.157.51/29 dev eth2:1
   up ip addr add aaa.bb.157.52/29 dev eth2:2
   up ip addr add aaa.bb.157.53/29 dev eth2:3
   up ip addr add aaa.bb.157.54/29 dev eth2:4
   post-up route add -net aaa.bb.176.0 netmask 255.255.255.0 dev eth2
   post-up route add default gw aaa.bb.176.241 dev eth2

If you also need to NAT from another "internal" IPs according to a specific
set of "external" IPs you could try a few IPTABLES rules a bit like this:

# Generated by iptables-save v1.3.8 on Fri Feb  6 17:56:17 2009
*nat
:PREROUTING ACCEPT [3131839:256972515]
:POSTROUTING ACCEPT [1508368:92173015]
:OUTPUT ACCEPT [900108:61778682]
-A POSTROUTING -s 192.168.254.50 -o eth2 -j SNAT --to-source aaa.bb.157.50
-A POSTROUTING -s 192.168.254.51 -o eth2 -j SNAT --to-source aaa.bb.157.51
-A POSTROUTING -s 192.168.254.52 -o eth2 -j SNAT --to-source aaa.bb.157.52
-A POSTROUTING -s 192.168.254.53 -o eth2 -j SNAT --to-source aaa.bb.157.53
-A POSTROUTING -s 192.168.254.54 -o eth2 -j SNAT --to-source aaa.bb.157.54
-A POSTROUTING -s 192.168.254.0/255.255.255.0 -o eth2 -j MASQUERADE
COMMIT
COMMIT
# Completed on Fri Feb  6 17:56:17 2009

With some criativety you can also create rules by port, by mac address, or
whatever you would like.

2009/10/14 Gilberto Nunes Ferreira <gilberto.nunes at selbetti.com.br>

> Hi all
>
> I have 5 public IP's.
> This is the interfaces file (/etc/network/interfaces):
>
> auto eth2
> iface eth2 inet static
> address aaa.bb.157.50
> network aaa.bb.157.0
> netmask 255.255.255.248
> post-up route add -net aaa.bb.176.0 netmask 255.255.255.0 dev eth2
> post-up route add default gw aaa.bb.176.241 dev eth2
>
> auto eth2:2
> iface eth2:2 inet static
> address aaa.bb.157.51
> netmask 255.255.255.248
>
> auto eth2:3
> iface eth2:3 inet static
> address aaa.bb.157.52
> netmask 255.255.255.248
>
> auto eth2:4
> iface eth2:4 inet static
> address aaa.bb.157.53
> netmask 255.255.255.248
>
> auto eth2:5
> iface eth2:5 inet static
> address aaa.bb.157.54
> netmask 255.255.255.248
>
> All when firewall has restarted, the main IP is aaa.bb.157.51, but ours
> main IP on DNS zone is aaa.bb.157.50.
> So, to fix this issue, I log in on firewall and run this command:
>
> service network restart
>
> So, the main IP back to aaa.bb.157.50
>
> This is a hard way to fix the problem, as you can see!
> Is there a better way to priorize IP aaa.bb.157.50 to be always main
> IP ???
>
> Thanks for any help
>
> Regards
>
>
> Gilberto Nunes Ferreira
>
>
>
> --
> ubuntu-server mailing list
> ubuntu-server at lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/ubuntu-server
> More info: https://wiki.ubuntu.com/ServerTeam
>



-- 
Fábio Leitão
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20091014/c1b77d18/attachment.html>


More information about the ubuntu-users mailing list