LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 07-20-2011, 10:40 PM   #1
kitek
Member
 
Registered: Apr 2005
Posts: 252

Rep: Reputation: 15
virtual ips on same server


I have some webserver that does virtual name servers for sites. I amd having a second ISP put in tomorrow. How do I have one interface and give it two public IP's? I will use two A records on DNS so it will use either A record to find the host.
 
Old 07-21-2011, 01:21 AM   #2
Nominal Animal
Senior Member
 
Registered: Dec 2010
Location: Finland
Distribution: Xubuntu, CentOS, LFS
Posts: 1,723
Blog Entries: 3

Rep: Reputation: 948Reputation: 948Reputation: 948Reputation: 948Reputation: 948Reputation: 948Reputation: 948Reputation: 948
You create an alias of the network interface, and assign the IP to the alias.

If the interface you want to alias is for example eth0 then the first alias will be eth0:0. If you add a third IP, you add a second alias, eth0:1, and so on.

The way you do this varies a bit between Linux distributions. You can use a tool like NetworkManager to manage them. On a server, I prefer not to. In RHEL, CentOS, and other RHEL or Fedora variants I would just create /etc/sysconfig/network-scripts/ifup-eth0:0
Code:
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static
IPADDR=IP-address
NETMASK=IP-netmask
In Debian and Ubuntu and variants, I would add the following to /etc/network/interfaces
Code:
auto eth0:0
iface eth0:0 inet static
    address IP-address
    netmask IP-netmask
Above, IP-address and IP-netmask could be for example 10.9.8.4 and 255.255.255.0, respectively.

To activate the new interfaces, I would run sudo /etc/init.d/networking restart (which should work in all). Then I'd also need to restart each service (like Apache) that is supposed to use the new IP address.
 
Old 07-22-2011, 11:43 PM   #3
kitek
Member
 
Registered: Apr 2005
Posts: 252

Original Poster
Rep: Reputation: 15
I have the new ISP in now. I have created a new Virtual Interface as eth0:1 and put the new ip in there as static and the system can ping itself with it. But I am unable to access it out side the box.(internet)
 
Old 07-23-2011, 08:51 AM   #4
Dani1973
Member
 
Registered: Dec 2010
Distribution: Debian testing
Posts: 148

Rep: Reputation: 16
What is the exact setup?
Does each ISP caonnection have a router and you use private IPs for your server (192.168.x.x or 172.16-31.x.x or 10.x.x.x)?

Anyway, your server will have 2 different gateways and you cannot configure 2 default gateways (at least not using a basic network configuration).

However, there is a way to do this using iproute2. What you need is a condition like "what comes in on one adapter goes out on that same adapter"

Have a look at this : http://www.linuxquestions.org/questi...teways-145635/
 
Old 07-23-2011, 07:02 PM   #5
kitek
Member
 
Registered: Apr 2005
Posts: 252

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Dani1973 View Post
What is the exact setup?
Does each ISP caonnection have a router and you use private IPs for your server (192.168.x.x or 172.16-31.x.x or 10.x.x.x)?

Anyway, your server will have 2 different gateways and you cannot configure 2 default gateways (at least not using a basic network configuration).

However, there is a way to do this using iproute2. What you need is a condition like "what comes in on one adapter goes out on that same adapter"

Have a look at this : http://www.linuxquestions.org/questi...teways-145635/
I am going to look at your link after I post. What I have is one ISP with 16 IPS w/router/gateway. Then I just had another put in with another ISP router/gateway.

One has a subnet of 240 and another of 248. I was hoping to have 1 line from each router feed a 10/100 switch. Then on the CentOS box assign one static on eth0 and then another as eth0:0 for the second ISP and then add 2 A records for the 2 IPS to the host. This way if either ISP goes out, the host is still there.

What can you help me with? Pls!
 
  


Reply



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
cURL: Server has many IPs, how would I make a cURL script use those IPs to send data? guest Programming 0 04-11-2009 11:42 AM
Virtual IPs and Postfix SMTP msound Linux - Server 7 10-30-2008 02:22 AM
name based virtual hosting with two ips nephish Linux - Server 3 07-05-2007 07:29 AM
Adding virtual ips to fedora 3 linchat Linux - Networking 2 09-17-2005 07:31 PM
Simulating multiple virtual IPs. vsg123 Linux - Networking 2 07-17-2003 01:06 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 04:41 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
Open Source Consulting | Domain Registration