?
Solved

How to configure a static IP for clients using Linux slackware

Posted on 2006-10-20
14
Medium Priority
?
5,527 Views
Last Modified: 2013-12-05
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.
0
Comment
Question by:AJKConcepts
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 2
  • 2
  • +3
14 Comments
 
LVL 45

Accepted Solution

by:
sunnycoder earned 2000 total points
ID: 17773880
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
 
LVL 2

Author Comment

by:AJKConcepts
ID: 17774124
how do i assign multiple IPs to a single NIC?  
0
 
LVL 45

Expert Comment

by:sunnycoder
ID: 17774701
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
Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

 
LVL 6

Expert Comment

by:collins23
ID: 17774779
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
 
LVL 5

Expert Comment

by:kyle_in_taiwan
ID: 17780914
/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
 

Expert Comment

by:VenomousGecko
ID: 17799027
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
 

Expert Comment

by:alester
ID: 17820966
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
 

Expert Comment

by:VenomousGecko
ID: 17821660
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
 
LVL 5

Expert Comment

by:kyle_in_taiwan
ID: 17824704
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
 
LVL 5

Expert Comment

by:kyle_in_taiwan
ID: 17824745
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
 
LVL 5

Expert Comment

by:kyle_in_taiwan
ID: 17824761
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
 
LVL 5

Expert Comment

by:kyle_in_taiwan
ID: 17824782
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
 
LVL 5

Expert Comment

by:kyle_in_taiwan
ID: 17824792
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

Featured Post

Tutorial: Introduction to Managing a Linux Server

In this tutorial on systemd, we will explore:
-OS/Distro Adoption
-chkconfig and Other Legacy Commands
-Summary and Key Commands

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating a Samba server for a small office. Ubuntu Linux and Samba can breathe new life into a retired PC and save an office money on new hardware/software. Our example server will have two hard disks, one exclusively for storing shared data. …
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question