LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   IP address alias (https://www.linuxquestions.org/questions/slackware-14/ip-address-alias-936260/)

Gerard Lally 03-24-2012 07:12 PM

IP address alias
 
I'm somewhat confused about setting an alias on an ethernet interface in /etc/rc.d/rc.inet1.conf.

I specify an alias as follows under the eth0 section:

Code:

# Config information for eth0:
IPADDR[0]="192.168.1.200"  # static address
NETMASK[0]="255.255.255.0"  # netmask
USE_DHCP[0]=""  # no dhcp
DHCP_HOSTNAME[0]=""  # no dhcp hostname   
IFNAME[0]="eth0:1"  # IP alias

I have two questions:

1) how do I specify an alternate IP address for the alias;

2) do I need to add a route for the alias?

Ser Olmy 03-24-2012 08:27 PM

When you add IFNAME[0]="<name>", you tell the init script to configure interface <name> instead of the default interface for section 0, which is eth0.

If you want to give the alias eth0:1 an IP address, you should do so in the next interface section, like this:

Code:

IFNAME[1]="eth0:1"
IPADDR[1]="<ip address>"
NETMASK[1]="<netmask>"
USE_DHCP[1]=""
DHCP_HOSTNAME[1]=""

When an interface is assigned an IP address, a direct route is added to the routing table automatically, based on the address and netmask. You do not have to add a route manually.

Gerard Lally 03-25-2012 10:40 AM

That did the trick. Thank you.


All times are GMT -5. The time now is 10:13 AM.