Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
 Post subject: IPTables and IP Aliasing
PostPosted: Thu Feb 19, 2009 3:17 pm 
Offline
Senior Member
User avatar

Joined: Mon Jul 21, 2008 1:26 pm
Posts: 171
Website: http://www.rejecttheherd.net
Location: Seattle
Is it possible? Since Linode no longer supports separate NIC's and we have to go with IP aliasing I'm having to rebuild my iptable rules. For the life of me I can't get them going, I've done some googleing and it seems that iptables doesn't support aliasing. Am I wrong? Is there a work around?

_________________
Image
Where "Thought Crime" is commited
http://www.rejecttheherd.net


Top
   
 Post subject:
PostPosted: Thu Feb 19, 2009 3:30 pm 
Offline
Senior Member

Joined: Thu Nov 25, 2004 10:05 am
Posts: 52
without you giving details of your firewall setup, its hard to say. In general you should simply be able to filter by the destination (-d) / source (-s) addresses?


Top
   
 Post subject:
PostPosted: Thu Feb 19, 2009 3:46 pm 
Offline
Senior Member
User avatar

Joined: Mon Jul 21, 2008 1:26 pm
Posts: 171
Website: http://www.rejecttheherd.net
Location: Seattle
TehDan wrote:
without you giving details of your firewall setup, its hard to say. In general you should simply be able to filter by the destination (-d) / source (-s) addresses?

It's a pretty basic setup, the previous setup I had eth0 configured with my public IP, eht1 was my private. I've got my mysql server on my private network and my db traffic going through the inside NIC.

Now with the recent change I try to open all traffic go the private IP and restrict my public to ssh, http, dns. Doesn't work, when ever I activate iptables now I loose connectivity to my db server on my private network :evil:

_________________
Image

Where "Thought Crime" is commited

http://www.rejecttheherd.net


Top
   
 Post subject:
PostPosted: Thu Feb 19, 2009 10:08 pm 
Offline
Senior Member
User avatar

Joined: Sun Jan 18, 2009 2:41 pm
Posts: 830
marcus0263 wrote:
I've got my mysql server on my private network and my db traffic going through the inside NIC.

Now with the recent change I try to open all traffic go the private IP and restrict my public to ssh, http, dns. Doesn't work, when ever I activate iptables now I loose connectivity to my db server on my private network


The following two additions ought to permit such traffic:

Code:
iptables -I INPUT 1 -s db.server.private.ip -j ACCEPT
iptables -I OUTPUT 1 -d db.server.private.ip -j ACCEPT


Of course, your DB server must be set up to permit the incoming traffic! If this doesn't work, maybe there's some fancy footwork going on in the other tables besides the 'filter' table? Do this to see what they contain:

Code:
iptables -t nat -nv -L
iptables -t mangle -nv -L
iptables -t raw -nv -L


If all else fails, you could create an ssh forward from the web server to the other host
Code:
ssh -L localhost:3306:localhost:3306 db.server.private.ip

and point your DB-using applications at 'localhost' instead of the other server. The extra overhead might slow down queries, but I don't know by how much.


Top
   
 Post subject:
PostPosted: Fri Feb 20, 2009 1:23 pm 
Offline
Junior Member

Joined: Thu Feb 05, 2009 12:48 pm
Posts: 24
Is this the securest solution?

iptables -I INPUT 1 -s db.server.private.ip -j ACCEPT
iptables -I OUTPUT 1 -d db.server.private.ip -j ACCEPT

Should ssltunnels be used or vpn?


Top
   
 Post subject:
PostPosted: Fri Feb 20, 2009 7:38 pm 
Offline
Senior Member
User avatar

Joined: Mon Jul 21, 2008 1:26 pm
Posts: 171
Website: http://www.rejecttheherd.net
Location: Seattle
I use fwbuilder to create and manage my rules and after messing about last night I just created rules based on IP to open up the traffic between the two. I was going wrong earlier by creating rules based on device, so after messing about all is well currently.

_________________
Image

Where "Thought Crime" is commited

http://www.rejecttheherd.net


Top
   
 Post subject:
PostPosted: Sun Feb 22, 2009 3:59 am 
Offline
Senior Member
User avatar

Joined: Sun Jan 18, 2009 2:41 pm
Posts: 830
bd3521 wrote:
Is this the securest solution?


It's rare that one can say that things can't possibly be made more secure. Those iptables rules only allow traffic to/from the specified IP (not other Linodes or random hosts on the Internet). However, the connection to the DB server is not encrypted or protected. In theory someone in the datacenter could sniff the traffic, so if you're paranoid you could use the ssh trick I described or configure SSL support in MySQL to encrypt it (among the other options you mentioned). Practically, I wouldn't worry about it unless I were processing credit card numbers or equally sensitive information.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group