How to configure a static IP for clients using Linux slackware

We provide T1 access to customers in our building, and one of our clients is requesting 3-5 static IPs.  Our traffic is routed through a server running Linux Slackware (used as a firewall).  There are 6 NIC cards installed on this server, 3 of which can be used to assign static IPs (there is a direct cat5 line from the card to the client).  What do I need to do to configure one of these cards to provide a static IP?  I know that it is eth4 that will be used, but I can't figure out how to access the configuration files and make changes, nor do I know what other steps are necessary (restarting services, etc.).  Any help is appreciated.
LVL 2
AJKConceptsAsked:
Who is Participating?
 
sunnycoderConnect With a Mentor Commented:
Hi AJKConcepts,

/sbin/ifconfig eth4 address <IP address> netmask <netmask> up
man ifconfig for details

IP address and other interface related information is commonly stored in  /etc/sysconfig/network-scripts/ifcfg-eth4

Cheers!
sunnycoder
0
 
AJKConceptsAuthor Commented:
how do i assign multiple IPs to a single NIC?  
0
 
sunnycoderCommented:
cd /etc/sysconfig/network-scripts

Make a copy of ifcfg-eth4 to ifcfg-eth4:0
cp ifcfg-eth4 ifcfg-eth4:0

Edit ifcfg-eth4:0 and change DEVICE to eth4:0 and change the IPADDR to new IP
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
collins23Commented:
use eth0:0 eth0:1

note the colon (:) and digit (0,1) after the eth0 referred to as sub-interfaces

for example

/sbin/ifconfig eth4:0 address <IP address> netmask <netmask> up
0
 
kyle_in_taiwanCommented:
/etc/sysconfig/network-scripts/ifcfg-eth4 is the path to the <i>Red Hat</i> bootscripts.

For Slackware, you should probably use the netconfig utility, or you should be able to find the config files for network interfaces at

/etc/rc.d/rc.inet1 (IP and network parameters)
/etc/rc.d/rc.inet2 (Network Services configuration)

This page is from the Slackware book and details exactly what you need to change and how:

http://slackbook.org/html/network-configuration-tcpip.html
0
 
VenomousGeckoCommented:
I am assuming that the card that has a cable running to a switch for your client has an IP address.  That IP address is in a subnet that you have created for your client.  Depending on the subnet mask that you assigned to that card you will be able to assign a number of IP addresses for nodes on that network.  You can dish them out using DHCP or, in this case, give them 3-5 static IPs for that subnet and then ensure that your DHCP server does not give those out to nodes on the network.  Hope this helps because I interpreted your question differently.
0
 
alesterCommented:
Here is my "/etc/network/interfaces" file. Take a look how to assign multiple IP's.

eth0 is the first interface and has 3 IP's 10.52.9.10 , 10.52.9.20 and 10.52.9.21
eth1 is the second interface and has 2 IP's 192.168.8.6 and 192.168.8.16

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
      address 10.52.9.10
      netmask 255.255.252.0
      network 10.52.9.0
      broadcast 10.52.9.255
      gateway 10.52.8.200
      # dns-* options are implemented by the resolvconf package, if installed
      dns-nameservers 10.52.8.1
      dns-search domain.extension

auto eth0:20
iface eth0:20 inet static
        address 10.52.9.20
        netmask 255.255.252.0
        network 10.52.9.0
        broadcast 10.52.9.255
        dns-nameservers 10.52.8.1
        dns-search domain.extension

auto eth0:21
iface eth0:21 inet static
        address 10.52.9.21
      netmask 255.255.252.0
        network 10.52.9.0
        broadcast 10.52.9.255
        dns-nameservers 10.52.8.1
        dns-search domain.extension

auto eth1
iface eth1 inet static
      address 192.168.8.6
      netmask 255.255.255.0
      network 192.168.8.0
      broadcast 192.168.8.255

auto eth1:1
iface eth1:1 inet static
      address 192.168.8.16
      netmask 255.255.255.0
      network 192.168.8.0
      broadcast 192.168.8.255

0
 
VenomousGeckoCommented:
What are you using on the client end to provide them service?  What is the purpose of configuring a card with multiple IP addresses on the same subnet on the Slackware box?  How are they getting IP's on your network as present?  Is it a DHCP server at this time?
0
 
kyle_in_taiwanCommented:
To add a card to /etc/network/interfaces:

auto = declares it to be automatically called up at boot time.

eth4 = device name of the NIC you want to configure

The following are probably self-explanatory;  it's important to note that the only two *required* fields are "address" and "netmask":

address = address you want to assign

netmask = the netmask representing the LAN configuration you are using

network = network prefix for your LAN  (shouldn't be necessary on a standard LAN with a properly configured netmask)

broadcast = broadcast address for your card (qualified same as "network", above)

gateway = address to your LAN's gateway.

What's odd, though, is that /etc/network/interfaces is a *Debian* configuration file -- not Slackware;  in fact, the /etc/network directory shouldn't even exist on a Slackware distribution (for an example, see here:  http://www.linuxforums.org/forum/slackware-linux-help/63049-detecting-network-card.html).  The Slackware configuration file should be as i noted above:  /etc/rc.d/rc.inet1.


Are you sure you're not working with a Debian distribution?  If you're not sure, you should check /proc/version:

$ cat /proc/version
0
 
kyle_in_taiwanCommented:
Also, this page describes the differences between the file systems:

http://www.physics.nmt.edu/~rsonnenf/research/LinuxCourse/bigpicture.rs

Scroll down to section IV, "Linux Network Configuration," or something like that.
0
 
kyle_in_taiwanCommented:
Anyway, to do what you want is rather simple:

auto iface eth4 inet static
  address <assign the IP address here>
  netmask <255.255.255.0 or 255.255.252.0>
  network <indicate which network the card will participate in:  192.168.8.0 or 10.52.9.0>
  broadcast <indicate which network the card will broadcast on: 192.168.8.255 or 10.52.9.255>
  <dns-nameservers 10.52.8.1, if necessary>
  <dns-search domain.extension, if necessary>

But like i said:  this is a Debian config file, not Slackware.
0
 
kyle_in_taiwanCommented:
To restart a Debian system, you simply do this:

/etc/init.d/networking restart

For Slackware, it should be something like this:

$ ifconfig eth4 down
$ /etc/rc.d/rc.inet1 restart

Although I haven't tried it myself, in principle this alone should work:

$ /etc/rc.d/rc.inet1 restart

If you're not sure, you can check it like this:

$ /etc/rc.d/rc.inet1 stop      // Should stop all interfaces, except for maybe the loopback, which you shouldn't need to stop
$ ifconfig -a                        // Will return the status of all interfaces.
$ /etc/rc.d/rc.inet1 start     // Will start up all interfaces
$ ifconfig -a
0
 
kyle_in_taiwanCommented:
Finally, there are some more tweaks you might need, depending on the distribution you're using.  So we really need to get that settled first.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.