LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   problem routing eth0:1 (https://www.linuxquestions.org/questions/linux-newbie-8/problem-routing-eth0-1-a-709681/)

mirostz 03-06-2009 01:13 PM

problem routing eth0:1
 
Hello guys,
I am running openvpn and when i nat via eth0 it is working good.
But when i try to change the outgoing ip which is at my second interface eth0:1 i get this error:

# iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0:1 -j MASQUERADE
Warning: wierd character in interface `eth0:1' (No aliases, :, ! or *).


How can i make an alias or something to make it work. Please help

billymayday 03-06-2009 01:43 PM

Iptables doesn't recognize aliases, so you will have to rely on source range and eth0

mirostz 03-07-2009 05:32 AM

Can someone give me a solution on this ?

r3sistance 03-07-2009 05:37 AM

Given billymayday's post above I would guess something like

iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE

I guess... that could be wrong tho! So I wouldn't try it until someone can confirm that.

mirostz 03-07-2009 06:21 AM

r3sistance thanks for your reply
this command is working pretty good:
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE

The thing is i want to use my eth0:1 or eth0:2 interface when i try to add them i get the error about wierd character in interface.

That's why i am asking if someone know how to make it work with eth0:1 ...

mirostz 03-07-2009 09:48 AM

hello guys i find a way to do it and i will share it with you so maybe it will help to someone:

interfaces:
eth0 75.x.x.1
eth0:1 75.x.x.2

locatel ip: 10.8.0.6

all you have to do is just type:
iptables -t nat -A POSTROUTING -s 10.8.0.6 -o eth0 -j SNAT --to-source 75.x.x.2

and your outgoing ip will be 75.x.x.2

have fun


All times are GMT -5. The time now is 02:58 PM.