Skip to contentSkip to conversation

iptables with alias?

DISCUSSION Jeppe Sørensen 3 participants 6 messages Oct 5, 2002

lore
Share & tools
lore
#0 lore raw

Hello

I have a little question that perhaps someone can help me with

I have a interface to the inet with 4 dynamic ip addr eth0 = first dynamic ip addr
eth0:0 = second dynmaic ip addr
and so on

I want to make 1 on 1 nat on the frist 2 aliass and the last 2 alias are for the rest of the network 192.168.1.5 nat to eth0
192.168.1.6 nat to eth0:0
192.168.1.7-to-15 nat to eth0:1
192.168.1.16-to-30 nat to eth0:2

but iptables wan't take alias

What do I do / what can I do ?

I have looked in the The netfilter user mailinglist Archives and found the following solution

ip addr add w.x.y.z/bits dev eth0 label eth00

but how does I get it to work with dynamic address?

The archive mail I found the solution in
http://lists.netfilter.org/pipermail/netfilter/2002-June/034592.html

Jeppe Sorensen
Denmark

#1 lore raw
Quoted 9 lines · Jeppe Sørensen

Hello

I have a little question that perhaps someone can help me with

I have a interface to the inet with 4 dynamic ip addr eth0 = first dynamic ip addr
eth0:0 = second dynmaic ip addr
and so on

Quoted 5 lines

I want to make 1 on 1 nat on the frist 2 aliass and the last 2 alias are for the rest of the network 192.168.1.5 nat to eth0 192.168.1.6 nat to eth0:0
192.168.1.7-to-15 nat to eth0:1
192.168.1.16-to-30 nat to eth0:2

You're right - netfilter doesn't accept : characters in interface names.

I suggest you create a script to (re)write appropriate SNAT rules, which is called by dhcpcd, or whatever else you use to acquire your dynamic addresses...

Antony.

Signature · 2 lines
The difference between theory and practice is that
in theory there is no difference, whereas in practice there is.
#2 lore raw

Hi Antony:

This just a test. My posts don't seem to be showing up on the list.

Regards,

Stu........

-----Original Message-----
From: [email protected] [mailto:[email protected]]On Behalf Of Antony Stone
Sent: October 5, 2002 1:53 PM
To: [email protected]
Subject: Re: iptables with alias?

Quoted 9 lines · Jeppe Sørensen

Hello

I have a little question that perhaps someone can help me with

I have a interface to the inet with 4 dynamic ip addr eth0 = first dynamic ip addr
eth0:0 = second dynmaic ip addr
and so on

Quoted 5 lines

I want to make 1 on 1 nat on the frist 2 aliass and the last 2 alias are for the rest of the network 192.168.1.5 nat to eth0 192.168.1.6 nat to eth0:0
192.168.1.7-to-15 nat to eth0:1
192.168.1.16-to-30 nat to eth0:2

You're right - netfilter doesn't accept : characters in interface names.

I suggest you create a script to (re)write appropriate SNAT rules, which is called by dhcpcd, or whatever else you use to acquire your dynamic addresses...

Antony.

--

The difference between theory and practice is that
in theory there is no difference, whereas in practice there is.

#3 lore raw

Trigger firewall Script on IP Change:

Hi All:

Can anyone tell me how to automatically trigger
my firewall script to execute when the IP on the External Interface changes. Thanks.

Stu.....

#4 lore raw

Re: Trigger firewall Script on IP Change:

Quoted 5 lines · Stewart Thompson

Hi All:

Can anyone tell me how to automatically trigger
my firewall script to execute when the IP on the External Interface changes. Thanks.

If your external IP address is changing, you must be using DHCP...

If you're using ISCs dhcpcd, you can create scripts called /etc/dhcpc/dhcpcd-<ifname>.exe where <ifname> is eth0, eth1, eth2 etc which will get called whenever there's a new address on the interface.

man dhcpcd for a bit more info.

Antony.

Signature · 2 lines
I vote "no" to this proposal to form a committee to investigate whether we 
should or should not hold a ballot on whether to vote yet.
#5 lore raw

RE: Trigger firewall Script on IP Change:

Hi Antony:

Thanks for the tip. I will have a look.
I new it was possible, I just wasn't sure how.

Regards,

Stu.......

-----Original Message-----
From: [email protected] [mailto:[email protected]]On Behalf Of Antony Stone
Sent: October 5, 2002 3:39 PM
To: [email protected]
Subject: Re: Trigger firewall Script on IP Change:

Quoted 5 lines · Stewart Thompson

Hi All:

Can anyone tell me how to automatically trigger
my firewall script to execute when the IP on the External Interface changes. Thanks.

If your external IP address is changing, you must be using DHCP...

If you're using ISCs dhcpcd, you can create scripts called /etc/dhcpc/dhcpcd-<ifname>.exe where <ifname> is eth0, eth1, eth2 etc which will get called whenever there's a new address on the interface.

man dhcpcd for a bit more info.

Antony.

--

I vote "no" to this proposal to form a committee to investigate whether we should or should not hold a ballot on whether to vote yet.