LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-06-2009, 01:13 PM   #1
mirostz
LQ Newbie
 
Registered: Mar 2009
Posts: 6

Rep: Reputation: 0
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

Last edited by mirostz; 03-06-2009 at 01:17 PM.
 
Old 03-06-2009, 01:43 PM   #2
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Iptables doesn't recognize aliases, so you will have to rely on source range and eth0
 
Old 03-07-2009, 05:32 AM   #3
mirostz
LQ Newbie
 
Registered: Mar 2009
Posts: 6

Original Poster
Rep: Reputation: 0
Can someone give me a solution on this ?
 
Old 03-07-2009, 05:37 AM   #4
r3sistance
Senior Member
 
Registered: Mar 2004
Location: UK
Distribution: CentOS 6/7
Posts: 1,375

Rep: Reputation: 216Reputation: 216Reputation: 216
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.

Last edited by r3sistance; 03-07-2009 at 05:38 AM.
 
Old 03-07-2009, 06:21 AM   #5
mirostz
LQ Newbie
 
Registered: Mar 2009
Posts: 6

Original Poster
Rep: Reputation: 0
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 ...
 
Old 03-07-2009, 09:48 AM   #6
mirostz
LQ Newbie
 
Registered: Mar 2009
Posts: 6

Original Poster
Rep: Reputation: 0
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
eth1 on second NIC stops routing on eth0 BethR Linux - Networking 9 01-30-2008 08:51 AM
Routing for eth0 and wlan0 with static IPs on the same network. kelvinlo Linux - Wireless Networking 3 10-15-2007 04:54 PM
eth0 not in routing table thymes Linux - Wireless Networking 20 11-07-2005 07:21 AM
eth0+ppp0 routing kwlg Linux - Networking 5 07-18-2005 05:50 PM
Internal Routing eth1 to eth0 Dataforce Linux - Networking 3 04-02-2004 09:41 AM


All times are GMT -5. The time now is 12:33 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration