Operating System - Linux
1838649 Members
2682 Online
110128 Solutions
New Discussion

how to config NICs with only one IP or even no IP

 

how to config NICs with only one IP or even no IP

noted that some system been configured with more than one NIC in only one IP, or even no ip at all, act as only one hub.

I wonder how to configure that.

thanks in advance

frederick van targero
frederick van targero
4 REPLIES 4
Chris Moran
Advisor

Re: how to config NICs with only one IP or even no IP

Hi Frederick,

It depends a little on what flavour of Linux you're using, but you need to do a couple of things:

1. Decide which NIC you're going to use (dmesg command will show you the NICs the system can find, and ifconfig will show you how they are configured now)

2. Many distributions use a configuration file /etc/network/interfaces which will have something like:

# The loopback interface
iface lo inet loopback

# The first network card - this entry was created during the Debian installation
# (network, broadcast and gateway are optional)
iface eth0 inet static
address 192.168.0.4
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
#
iface eth1 inet static
address 192.168.1.4
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255

The eth0 and eth1 seem to be allocated based on the order that the network drivers are loaded. If I wanted to use just eth1, I would just comment out the lines associated with eth0, so now it would look like:

# The loopback interface
iface lo inet loopback

# The first network card - this entry was created during the Debian installation
# (network, broadcast and gateway are optional)
#iface eth0 inet static
# address 192.168.0.4
# netmask 255.255.255.0
# network 192.168.0.0
# broadcast 192.168.0.255
# gateway 192.168.0.1
#
iface eth1 inet static
address 192.168.1.4
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1

I hope this helps!
Think what you can do...
Steven E. Protter
Exalted Contributor

Re: how to config NICs with only one IP or even no IP

Red Hat et al

in the file

/etc/sysconfig/network-scripts/ifcfg-eth0

There is a parameter called ONBOOT

ONBOOT='yes'

You can set it to no. Unless this is some kind of school project, I can't see why you'd actually want to use a Linux machine as a hub. You get far more functionality with an IP address, using it as a router.

Change
ONBOOT='no' to accomplish your stated goal.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Michael Steele_2
Honored Contributor

Re: how to config NICs with only one IP or even no IP

This is 'IP spoofing' also known as promiscuous mode. For example:

ifconfig eth0 promisc

Puts 'eth0' into promiscuous mode.

Basically, you collect everything, and filter nothing. You know, like a sniffer. Like tcpdump or etheral. Same thing.

http://www.redhat.com/docs/manuals/linux/RHL-9-Manual/security-guide/s1-ids-net.html
Support Fatherhood - Stop Family Law
Michael Steele_2
Honored Contributor

Re: how to config NICs with only one IP or even no IP

You let the application 'tcpdump' use your NIC in promiscuous mode. Download a copy:

http://hpux.cict.fr/hppd/hpux/Networking/Admin/tcpdump-3.6.2/
Support Fatherhood - Stop Family Law