LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 09-20-2007, 10:01 AM   #1
dirtmaster88
LQ Newbie
 
Registered: Sep 2007
Posts: 12

Rep: Reputation: 0
Multiple IPs On One NIC?


Hello,

I previously have used SuSe and Ubuntu linux and was able to configure multiple IP addresses for my single NIC card. I am now experimenting with slackware to try to get a lightweight OS for basic needs. So far I am running xfce and everything has gone incredibly smooth.

I need to use multiple IP addresses on one NIC because my workplace has special permissions for different IPs. Since I need to support all sorts of users, I need to be able to talk to different IP vlans.

I've searched google and many forums on how to configure my NIC card for more more just one but have come up with nothing related to slackware. I found the file that I think I need to edit which is /etc/rc.d/rc.inet1.conf?

I see my current info in there but I need to add eth0:0, eth0:1 etc.
I need to configure an IP, subnet, and default gateway for each additional IP.

Could anyone give me some guidance?

Thanks a bunch!
 
Old 09-20-2007, 10:15 AM   #2
andrewld
LQ Newbie
 
Registered: Jul 2007
Distribution: Slackware-15 64-bit
Posts: 20

Rep: Reputation: 1
Take a look lower down the same file, where it says:

#IFNAME[4]="eth0:1" # Set up an IP alias.

HTH

Andrew
 
Old 09-20-2007, 11:41 AM   #3
dirtmaster88
LQ Newbie
 
Registered: Sep 2007
Posts: 12

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by andrewld View Post
Take a look lower down the same file, where it says:

#IFNAME[4]="eth0:1" # Set up an IP alias.

HTH

Andrew
I do not see this section in my file.
This is the closest info to it:

# Config information for eth0:
IPADDR[0]="x.x.0.51"
NETMASK[0]="255.255.0.0"
USE_DHCP[0]=""
DHCP_HOSTNAME[0]=""

Could I just add this below it? (replacing the x's of course)

# Config information for eth0:1
IPADDR[0:1]="x.x.0.52"
NETMASK[0:1]="255.255.0.0"
USE_DHCP[0:1]=""
DHCP_HOSTNAME[0:1]=""
 
Old 09-20-2007, 11:54 AM   #4
randomsel
Member
 
Registered: Oct 2006
Location: Wilmington, DE
Distribution: Slackware 11
Posts: 201

Rep: Reputation: 30
Quote:
Originally Posted by dirtmaster88 View Post
I do not see this section in my file.
This is the closest info to it:

# Config information for eth0:
IPADDR[0]="x.x.0.51"
NETMASK[0]="255.255.0.0"
USE_DHCP[0]=""
DHCP_HOSTNAME[0]=""

Could I just add this below it? (replacing the x's of course)

# Config information for eth0:1
IPADDR[0:1]="x.x.0.52"
NETMASK[0:1]="255.255.0.0"
USE_DHCP[0:1]=""
DHCP_HOSTNAME[0:1]=""
I... think you've got to leave the number inside the [] as 0,1,2,3,4. That's the order of the interfaces to configure. Could someone tell me how many the script supports? Never done more than 5...

IFNAME will tell the script what's the name of the interface to configure, so you'd do:

Code:
# Config information for eth0:
IPADDR[0]="x.x.0.51"
NETMASK[0]="255.255.0.0"
USE_DHCP[0]=""
DHCP_HOSTNAME[0]=""

# Config information for eth0:1
IFNAME[1]="eth0:1"
IPADDR[1]="x.x.x.x"
NETMASK[1]="255.255.0.0"
USE_DHCP[1]=""
DHCP_HOSTNAME[1]=""
and so forth
 
Old 09-20-2007, 12:45 PM   #5
dirtmaster88
LQ Newbie
 
Registered: Sep 2007
Posts: 12

Original Poster
Rep: Reputation: 0
I thought the numbers 1,2,3 etc would be other NIC cards in the system and for example 2:2 would be IP address #3 on the 3rd nic card (assuming 0 is the first and in my case the only NIC)
 
Old 09-20-2007, 02:16 PM   #6
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559

Rep: Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106
No, randomsel is correct in his example.

Eric
 
Old 09-20-2007, 05:29 PM   #7
piete
Member
 
Registered: Apr 2005
Location: Havant, Hampshire, UK
Distribution: Slamd64, Slackware, PS2Linux
Posts: 465

Rep: Reputation: 44
To elaborate on Eric's response (no disrespect intended) you have to leave them as integer values because they're array indices in a script =)

So the maximum limit would be ... uhm ... lots. The theoretical maximum would be INT_MAX, I expect, but I don't know anything about the code behind the shell, and then there's memory limits and all sorts of other things.

For all intents and purposes, more numbers than you should ever need =D

Last edited by piete; 09-20-2007 at 05:31 PM. Reason: Typos
 
Old 09-21-2007, 12:27 AM   #8
dirtmaster88
LQ Newbie
 
Registered: Sep 2007
Posts: 12

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Alien Bob View Post
No, randomsel is correct in his example.

Eric
I'll give this a go tomorrow at work. Thanks so much for the clarification, great community of people here :-)
 
Old 09-21-2007, 08:59 AM   #9
dirtmaster88
LQ Newbie
 
Registered: Sep 2007
Posts: 12

Original Poster
Rep: Reputation: 0
After changing my config to this and doing "ifconfig eth0 down" then "/etc/rc.d/rc.inet1" it only brings back up my eth0 configuration, not my eth0:1

# Config information for eth0:
IPADDR[0]="x.x.1.51"
NETMASK[0]="255.255.0.0"
USE_DHCP[0]=""
DHCP_HOSTNAME[0]=""

# Config information for eth0:1
IFNAME[1]="eth0:1"
IPADDR[1]="x.x.0.33"
NETMASK[1]="255.255.0.0"
USE_DHCP[1]=""
DHCP_HOSTNAME[1]=""

Last edited by dirtmaster88; 09-21-2007 at 09:13 AM.
 
Old 09-21-2007, 09:55 AM   #10
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559

Rep: Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106
This started me wondering:
Quote:
I do not see this section in my file.
What version of Slackware are you running? Out of the box configuration of network aliases was added to Slackware 10.2.

Eric
 
Old 09-21-2007, 10:08 AM   #11
dirtmaster88
LQ Newbie
 
Registered: Sep 2007
Posts: 12

Original Poster
Rep: Reputation: 0
I am running the latest; 12.

This is exactly what is in my rc.inet1.conf file right now. I took out the eth0:1 stuff for now because it's not working.


bash-3.1# cat /etc/rc.d/rc.inet1.conf
# /etc/rc.d/rc.inet1.conf
#
# This file contains the configuration settings for network interfaces.
# If USE_DHCP[interface] is set to "yes", this overrides any other settings.
# If you don't have an interface, leave the settings null ("").

# You can configure network interfaces other than eth0,eth1... by setting
# IFNAME[interface] to the interface's name. If IFNAME[interface] is unset
# or empty, it is assumed you're configuring eth<interface>.

# Several other parameters are available, the end of this file contains a
# comprehensive set of examples.

# =============================================================================

# Config information for eth0:
IPADDR[0]="x.x.1.51"
NETMASK[0]="255.255.0.0"
USE_DHCP[0]=""
DHCP_HOSTNAME[0]=""

# Config information for eth1:
IPADDR[1]=""
NETMASK[1]=""
USE_DHCP[1]=""
DHCP_HOSTNAME[1]=""

# Config information for eth2:
IPADDR[2]=""
NETMASK[2]=""
USE_DHCP[2]=""
DHCP_HOSTNAME[2]=""

# Config information for eth3:
IPADDR[3]=""
NETMASK[3]=""
USE_DHCP[3]=""
DHCP_HOSTNAME[3]=""

# Default gateway IP address:
GATEWAY="x.x.1.1"

# Change this to "yes" for debugging output to stdout. Unfortunately,
# /sbin/hotplug seems to disable stdout so you'll only see debugging output
# when rc.inet1 is called directly.
DEBUG_ETH_UP="no"

## Example config information for wlan0. Uncomment the lines you need and fill
## in your info. (You may not need all of these for your wireless network)
#IFNAME[4]="wlan0"
#IPADDR[4]=""
#NETMASK[4]=""
#USE_DHCP[4]="yes"
#DHCP_HOSTNAME[4]="icculus-wireless"
#DHCP_KEEPRESOLV[4]="yes"
#DHCP_KEEPNTP[4]="yes"
#DHCP_KEEPGW[4]="yes"
#DHCP_IPADDR[4]=""
#WLAN_ESSID[4]=BARRIER05
#WLAN_MODE[4]=Managed
##WLAN_RATE[4]="54M auto"
##WLAN_CHANNEL[4]="auto"
##WLAN_KEY[4]="D5AD1F04ACF048EC2D0B1C80C7"
##WLAN_IWPRIV[4]="AuthMode=WPAPSK EncrypType=TKIP WPAPSK=7B1ABEEB5D197741923ED26727569C365E31212096A0EAFAD563B268BAD01CAF TxRate=0"
#WLAN_WPA[4]="wpa_supplicant"
#WLAN_WPADRIVER[4]="ndiswrapper"

## Some examples of additional network parameters that you can use.
## Config information for wlan0:
#IFNAME[4]="wlan0" # Use a different interface name nstead of
# the default 'eth4'
#HWADDR[4]="00:01:23:45:67:89" # Overrule the card's hardware MAC address
#MTU[4]="" # The default MTU is 1500, but you might need
# 1360 when you use NAT'ed IPSec traffic.
#DHCP_KEEPRESOLV[4]="yes" # If you dont want /etc/resolv.conf overwritten
#DHCP_KEEPNTP[4]="yes" # If you don't want ntp.conf overwritten
#DHCP_KEEPGW[4]="yes" # If you don't want the DHCP server to change
# your default gateway
#DHCP_IPADDR[4]="" # Request a specific IP address from the DHCP
# server
#WLAN_ESSID[4]=DARKSTAR # Here, you can override _any_ parameter
# defined in rc.wireless.conf, by prepending
# 'WLAN_' to the parameter's name. Useful for
# those with multiple wireless interfaces.
#WLAN_IWPRIV[4]="AuthMode=WPAPSK EncrypType=TKIP WPAPSK=thekey TxRate=0"
# Some drivers require a private ioctl to be
# set through the iwpriv command. If more than
# one is required, you can place them in the
# IWPRIV parameter (space-separated, see the
# example).
 
Old 09-21-2007, 10:17 AM   #12
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559

Rep: Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106
Your rc.inet1.conf file shows signs (in the commented part) of an older Slackware version.
Can you check if the version of /etc/rc.d/rc.inet1 is the one that ships with Slackware 12.0? Possibly you might not have updated to the newer version of the script in the case where you have been upgrading Slackware to the version 12.0.

Check this, it is the Slackware 12.0 version: http://www.slackware.com/~alien/rc_s...-12.0/rc.inet1

Eric
 
Old 09-21-2007, 10:27 AM   #13
dirtmaster88
LQ Newbie
 
Registered: Sep 2007
Posts: 12

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Alien Bob View Post
Your rc.inet1.conf file shows signs (in the commented part) of an older Slackware version.
Can you check if the version of /etc/rc.d/rc.inet1 is the one that ships with Slackware 12.0? Possibly you might not have updated to the newer version of the script in the case where you have been upgrading Slackware to the version 12.0.

Check this, it is the Slackware 12.0 version: http://www.slackware.com/~alien/rc_s...-12.0/rc.inet1

Eric
That's very interesting because this is the first and only time I've downloaded or installed slackware before. I downloaded the version 12 DVD.

The date "Sun Jul 24 12:45:56 PDT 2005" of my rc.inet1 file matches the link you showed me.

Last edited by dirtmaster88; 09-21-2007 at 10:31 AM.
 
Old 09-21-2007, 12:11 PM   #14
acummings
Member
 
Registered: Jul 2004
Distribution: Slackware
Posts: 615

Rep: Reputation: 50
FWIW here's my Slack 12.0 rc.inet1.conf

snip_the_url

(I just diff'ed mine versus the OP's and my rc.inet1.conf is the same as the OP's)

Mine is from a new, fresh install of Slack 12.0

An unofficial DVD that I made after rsyncing from the next

http://slackware.mirrors.tds.net/pub...lackware-12.0/

--
Alan.

Last edited by acummings; 09-21-2007 at 05:00 PM. Reason: diff turns up that my rc.inet1.conf is same as OP's
 
Old 09-21-2007, 12:56 PM   #15
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559

Rep: Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106
Quote:
Originally Posted by dirtmaster88 View Post
That's very interesting because this is the first and only time I've downloaded or installed slackware before. I downloaded the version 12 DVD.
Well that rc.inet1.conf file contains stuff that is not in Slackware 12.0 version of the file.
Quote:
The date "Sun Jul 24 12:45:56 PDT 2005" of my rc.inet1 file matches the link you showed me.
Don't look at that RCS stamp - it does not tell anything... the file was not checked in for a long time. Do a 'diff' between your file and the file in the URL instead.

Where did you download that Slackware 12.0 DVD by the way? Does the md5sum you can calculate for your ISO match the published one? I don't believe for a second that you did a fresh install off an official Slackware 12.0 DVD.

Eric
 
  


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
CentOS 4.2: Multiple IPs on a single NIC SupaDucta Linux - Networking 2 12-17-2005 04:35 PM
Multiple IPs on one NIC - How to use them all? MG-Cloud Linux - Networking 4 10-03-2005 02:28 AM
multiple IPs, one NIC, different networks branden_burger Linux - Networking 3 03-15-2005 07:24 AM
multiple IPs, one nic v4lu3s Linux - Networking 4 02-07-2004 10:52 AM
binding multiple IPs to single NIC? lok1 Linux - Networking 2 11-16-2003 02:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 04:40 PM.

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