Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Wed Dec 28, 2011 12:12 am 
Offline
Junior Member

Joined: Thu Jun 16, 2011 12:49 am
Posts: 27
Hello,

I just added a new IP address to my Linode and I am having some difficulties with setting which connection my OpenVPN server should forward network traffic through. Initially all my traffic was directed through 96.126.100.xxx, but upon adding another IP (50.116.1.xxx), all my traffic began going through that one instead. How do I go about specifying that my connections should go through 96.126.100.xxx?

My configuration for my network is as follows:

/etc/network/interfaces:
Code:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
  address 96.126.100.xxx
  netmask 255.255.255.0
  gateway 96.126.100.1

auto eth0:0
iface eth0:0 inet static
  address 50.116.1.xxx
  netmask 255.255.255.0
  gateway 50.116.1.1


/etc/rc.local:
Code:
iptables -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -s 10.7.0.0/24 -j ACCEPT
iptables -A FORWARD -s 10.8.0.0/24 -j ACCEPT
iptables -A FORWARD -s 10.9.0.0/24 -j ACCEPT
iptables -A FORWARD -j REJECT
iptables -t nat -A POSTROUTING -s 10.7.0.0/24 -o eth0 -j MASQUERADE
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE
iptables -t nat -A POSTROUTING -s 10.9.0.0/24 -o eth0 -j MASQUERADE

exit 0


Signed,
Ryan Tse


Top
   
 Post subject:
PostPosted: Wed Dec 28, 2011 12:25 am 
Offline
Senior Member
User avatar

Joined: Sat Aug 30, 2008 1:55 pm
Posts: 1739
Location: Rochester, New York
With IPv6 addresses, my usual approach is to add 'preferred_lft 0'. I can't recall if this works for IPv4, but if it does:

Code:
auto eth0
iface eth0 inet static
  address 96.126.100.xxx
  netmask 255.255.255.0
  gateway 96.126.100.1
  up /sbin/ip addr add 50.116.1.xxx dev eth0 preferred_lft 0


... then omit the auto eth0:0 and iface eth0:0 stuff entirely.

Alternatively, leave the "gateway" off of the eth0:0 stanza. All other things being equal, the kernel will pick the most recently added default route, and that would be the last one...

_________________
Code:
/* TODO: need to add signature to posts */


Top
   
 Post subject:
PostPosted: Wed Dec 28, 2011 12:47 am 
Offline
Junior Member

Joined: Thu Jun 16, 2011 12:49 am
Posts: 27
I tried the way you specified "up /sbin/ip ..." and that didn't work. But, removing the gateway from the eth0:0 stanza worked. Thanks for your help! :D


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


Who is online

Users browsing this forum: No registered users and 3 guests


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