LinuxQuestions.org

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

slacknut 03-31-2003 03:12 AM

IP Alias
 
Could someone point me in the right direction on how to have multiple ip # on a slackware box?

I have added this to rc.inet1.


Code:

/sbin/ifconfig eth0:1 XX.XX.XX.XX netmask 255.255.255.176 broadcast XX.XX.XX.XX
/sbin/route add -host XX.XX.XX.XX eth0:1

This is the error I get.

SIOCSIFADDR: No such device
SIOCSIFFLAGS: No such device
SIOCSIFNETMASK: No such device
SIOCSIFBRDADDR: No such device
SIOCSIFFLAGS: No such device

Using 7.1 and do not see the ip_alias.o file like in older versions.
Is there a new way to do this that I have not found?

Unseen 03-31-2003 07:05 AM

Actually, I think your problem is the second line:

/sbin/route add -host XX.XX.XX.XX eth0:1

should be:
/sbin/route add -host XX.XX.XX.XX eth0.1

You are getting the error when using route, right?

Hope that helps.

Excalibur 03-31-2003 07:08 AM

I have several machines that use multiple IP addresses. I normally do not need to add the route command at all. Usually though these are additional IP's on the existing network and no additional routing is required. Under 2.4 kernel when the IP is assigned it creates a routing entry for the subnet if required. They are also currently running 2.4 series kernel. If I recall Slack 7.1 was 2.2 kernel based. It might be required though for a 2.2 kernel, I do not remember. But it is easy enough to check after the the NIC is configured. (route -n)

I looked at the config for a 2.2.19 kernel source, probably from Slack 8.0, there was an option to enable IP: aliasing support. Also, 2.0 kernel has an option to enable Network Aliasing. So you probably want to check your kernel build options to see if it is enabled. When I enabled modules, the option would not allow for a module and the help did not state that a module was available or what the name would be. The option seems to have been removed in the 2.4 kernel.

From the error message reported, I am *assuming* that the initial config is working on the device eth0. I do not think the alias assignments have to be sequential on the assignment, unless it is required on the first alias. I noticed that you are using eth0:1 instead of eth0:0. If the device eth0 cannot be configured then you probably need to load the module support for the network adapter. I have always configured, eth0, eth0:0, eth0:1, etc. in that order.

Perhaps it will help.

slacknut 03-31-2003 04:48 PM

I have 16 IP#'s that my ISP has assigned to me. 2 are being used on desktops, the others I have setup on three different servers. 2 with 1 IP each and the other is where I am trying to setup additional IP's on the machine. I am still stuck on this.

Thanks

Excalibur 03-31-2003 05:00 PM

Is the first assignment on eth0 working OK? Is there an eth0:0 configured?

slacknut 03-31-2003 05:11 PM

Quote:

Originally posted by Excalibur
Is the first assignment on eth0 working OK? Is there an eth0:0 configured?
eth0 is working I can route to that IP.

If I try:
Code:

/sbin/ifconfig eth0:0 xx.xx.xx.167 netmask 255.255.255.176 broadcast xx.xx.xx.175
This is where I get the errors:

SIOCSIFADDR: No such device
SIOCSIFFLAGS: No such device
SIOCSIFNETMASK: No such device
SIOCSIFBRDADDR: No such device
SIOCSIFFLAGS: No such device

Thanks

Excalibur 03-31-2003 07:36 PM

If you are running a 2.2.x kernel then it looks like you will need to build a custom kernel to enable IP Aliasing. Since it looks you need to do a kernel build then perhaps consider the latest stable, 2.4.20 kernel.

Also, in regards to the numbers you posted. I think you are using the wrong subnet mask. I believe it should be 255.255.255.240. For a 16 IP subnet block assignment with a broadcast on .175 then the net assignment would be on .160 and the first usable IP address would be .161 and the last IP would be .174.

For a subnet assignment the 8 bit number would a sequence of one's starting with the most significant bit.

Bit = Subnet mask : size of subnet
1 = 128 : 128 IP subnet
1 = 192 : 64 IP subnet
1 = 224 : 32 IP subnet
1 = 240 : 16 IP subnet
1 = 248 : 8 IP subnet
1 = 252 : 4 IP subnet
1 = 254 : 2 IP subnet
1 = 255 : single IP address

A value of 176 would leave a zero in the 7th significant bit. ( 10110000 ) I would think this would be an illegal subnet assignment. It should be 11110000 or a decimal value of 240. Or another way to consider the subnet assignment value; 128 + 64 + 32 + 16 = 240.

slacknut 03-31-2003 08:37 PM

Quote:

Originally posted by Excalibur
If you are running a 2.2.x kernel then it looks like you will need to build a custom kernel to enable IP Aliasing.........

Also, in regards to the numbers you posted. I think you are using the wrong subnet mask. I believe it should be 255.255.255.240.


Excalibur,
How would I enable IP Aliasing when I rebuild a kernal? I am downloading the latest 2.4.20 source now.

Also I changed the netwmask to 255.255.255.240. then original was set to this but I changed it for some odd reason I do not remember.

Thanks for you help

Excalibur 03-31-2003 09:12 PM

From what I can deternine you only need to enable TCP/IP protocol for the support. I am not able to locate any specific option for IP Aliases in the 2.4.x kernel. Now, I have the TCP/IP enabled with IP Mulitcasting, IP Advanced router, and IP Policy routing enabled. But none these options mention the alias support. Now my kernel also has Packet socket, packet filtering, socket filtering, Unix Domain Sockets, and a lot of stuff under Netfilter options. It is firewall, Masq, gateway server as well as a hosting server.

Since there are so many options to compiling a new kernel when you really do not have a starting config file. I may suggest two choices. If you want a modules based kernel then use a config file of your choice from the Slack 9 distro. It is 2.4.20 based. If you want a module disabled starting point and the options that I have, then send me an email through my profile and I will attach a config and return it to you. I don't mind using modules on workstations that are generally behind firewalls, but I do not like modules on production servers. I prefer to fully integrate all drivers and support into the kernel whenever possible.

Let me know if I can help in any other way.

Excalibur 03-31-2003 09:21 PM

Also, something else that you may or may not have a problem with. I think it was around Slack 8.0 that the firewall support changed from ipchains to iptables. If you are using ipchains currently for filtering, then be carefull not to disable it in the 2.4.20 kernel. Your older Slack version does not have iptables installed and it would require a complete rewrite of the firewall rules to switch to iptables.


All times are GMT -5. The time now is 01:20 AM.