Solved

How to configure a static IP for clients using Linux slackware

Posted on 2006-10-20
14
5,489 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
  • 6
  • 2
  • 2
  • +3
14 Comments
 
LVL 45

Accepted Solution

by:
sunnycoder earned 500 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
 
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

After running Ubuntu some time, you will be asked to download updates for fixing bugs and security updates. All the packages you download replace the previous ones, except for the kernel, also called "linux-image". This is due to the fact that w…
This document is written for Red Hat Enterprise Linux AS release 4 and ORACLE 10g.  Earlier releases can be installed using this document as well however there are some additional steps for packages to be installed see Metalink. Disclaimer: I hav…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

759 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now