Jump to content

One Nic 4 IPs


Guest Jose
 Share

Recommended Posts

Guest Jose

Hi,

I will soon have 5 IP addresses. But I only have one NIC on the computer which will use 4 of the ips. The Linux box will serve as a web server, ftp and maybe dns. Is is possible to point 4 ip addresses to one nic?

Link to comment
Share on other sites

Sure you can, search for "virtual hosts".

 

I don't know how to set them for an external interface, you'll probably need to hack a bit with your iptables.

 

Basically, the proccess should be similar to the way is done in a LAN. You have to add aliases to your network interface; ie, in my LAN I've set up 9 virtual hosts for my eth0 interface:

/etc# cat /etc/sysconfig/network-scripts/ifcfg-eth0:0

IPADDR="192.168.0.10-19"

/etc#

So that range of IPs (192.168.0.10-19) are assigned to my eth0 NIC.

 

Then on each machine of my lan I assign each IP to each virtual name.domain.ext; I do this by editing /etc/hosts (I don't use dhcp)

 

Also you have to set the virtual hosts address/name if the server application requires it; ie, apache:

/etc# cat /etc/httpd/conf/vhosts/Vhosts.conf

[...]

<VirtualHost 192.168.0.11>

       DocumentRoot /home/httpd/public_html/

       ServerName www.somename.org

       ServerAdmin aru@somename.org

       ErrorDocument 400 /error.php

       ErrorDocument 401 /error.php

       ErrorDocument 403 /error.php

       ErrorDocument 404 /error.php

       ErrorDocument 500 /error.php

</VirtualHost>

[...]

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...