LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices



Reply
 
Search this Thread
Old 11-05-2007, 09:10 AM   #1
PcHammer
Member
 
Registered: Jan 2001
Location: Ljubljana Slovenija
Distribution: Slackware
Posts: 70

Rep: Reputation: 15
How to bind ip to a specific NIC


Hi,

This might be a stupid question but i just can't find the answer.
I'm running slackware 10.2.0 and i have 3 network cards, now 2 of them are 100 MBit and one is 1GBit, i would like to bind a special ip to a specific card, like Eth0 to first 100MBit Eth1 to 1GBit card ...
When i run ifconfig it picks up the first card and bind ip to it, i would like to control to witch card ip it binded.

I hope i explained this in a understandable way.

regards, Milos
 
Old 11-05-2007, 09:31 AM   #2
camorri
Senior Member
 
Registered: Nov 2002
Location: Somewhere inside 9.9 million sq. km. Canada
Distribution: Slackware 14.1
Posts: 4,869

Rep: Reputation: 434Reputation: 434Reputation: 434Reputation: 434Reputation: 434
Are yo running DHCP? If yes, and the server is a router, look in your router config. In mine I can set which DHCP address is assigned to which MAC address.

The only stupid question is one I can't answer...

Hope this helps.
 
Old 11-05-2007, 09:32 AM   #3
rcs1000
Member
 
Registered: Feb 2004
Posts: 30

Rep: Reputation: 15
Quote:
Originally Posted by PcHammer View Post
Hi,

This might be a stupid question but i just can't find the answer.
I'm running slackware 10.2.0 and i have 3 network cards, now 2 of them are 100 MBit and one is 1GBit, i would like to bind a special ip to a specific card, like Eth0 to first 100MBit Eth1 to 1GBit card ...
When i run ifconfig it picks up the first card and bind ip to it, i would like to control to witch card ip it binded.

I hope i explained this in a understandable way.

regards, Milos
There are various ways to achieve this. The easiest is probably on your router, which usually has a "Bind IP to MAC" function.

Use ifconfig to find the MAC address of eth0, then on the router, tell it to assign this to 192.16.x.x or whatever.

Regards,

Robert
 
Old 11-06-2007, 01:18 AM   #4
PcHammer
Member
 
Registered: Jan 2001
Location: Ljubljana Slovenija
Distribution: Slackware
Posts: 70

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by camorri View Post
Are yo running DHCP? If yes, and the server is a router, look in your router config. In mine I can set which DHCP address is assigned to which MAC address.

The only stupid question is one I can't answer...

Hope this helps.
No sadly i'm not running a DHCP if i would this would be easy, i have 3 NICs with static IP address (its a iptables firewall) and it also has the function of a main router.
 
Old 11-06-2007, 02:36 AM   #5
wanghao
Member
 
Registered: Mar 2007
Distribution: centos
Posts: 126

Rep: Reputation: 15
in my opinion ifconfig is the best choice ,but you did't give us more details
about ifconfig why not useful fou you /
 
Old 11-06-2007, 03:33 AM   #6
PcHammer
Member
 
Registered: Jan 2001
Location: Ljubljana Slovenija
Distribution: Slackware
Posts: 70

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by wanghao View Post
in my opinion ifconfig is the best choice ,but you did't give us more details
about ifconfig why not useful fou you /

Hmm i might not be clear enough, i'm using ifconfig to set up my NICs but how do i control to witch NIC a specific ip is assigned.

i'm using:

ifconfig eth0 192.168.0.1 netmask 255.255.255.0 up
ifconfig eth1 192.168.1.1 netmask 255.255.255.0 up
ifconfig eth2 192.168.2.1 netmask 255.255.255.0 up

So basicly i need something to tell ifconfig with NIC to use for eth0... and so on.

Last edited by PcHammer; 11-06-2007 at 03:36 AM.
 
Old 11-06-2007, 07:25 AM   #7
PcHammer
Member
 
Registered: Jan 2001
Location: Ljubljana Slovenija
Distribution: Slackware
Posts: 70

Original Poster
Rep: Reputation: 15
I managed to find the solution for this problem and its working now like a charm.

All you need to do is make aliases for your eth0, eth1 ... in /etc/modules.conf
alias eth0 3c59x
alias eth1 tg3
alias eth2 8139too

Also you need to hash network modules that are loaded in /etc/rc.d/rc.modules and load them in /etc/rc.d/rc.netdevice
# Load module for network device.
# This script is automatically generated during the installation.

/sbin/modprobe 3c59x
/sbin/modprobe tg3
/sbin/modprobe 8139too
regards, Milos
 
Old 11-06-2007, 09:49 PM   #8
wanghao
Member
 
Registered: Mar 2007
Distribution: centos
Posts: 126

Rep: Reputation: 15
yes,i've to admit that's a good way.i'll take it.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
ssh forwarding : bind to a specific interface flupke Linux - Networking 9 12-09-2011 06:24 PM
BIND cannot resolve specific domain name - is INEXPLICABLE subcon Linux - Server 5 05-03-2007 05:56 PM
how do i bind a port to a specific nic? rsmccain Linux - Networking 2 04-24-2006 02:36 PM
Need to route traffic through specific nic cards... Thaidog Linux - Networking 4 07-01-2005 08:31 PM
Bind ETH devices to specific NIC/MAC not_an_expert Slackware 8 10-13-2004 12:00 PM


All times are GMT -5. The time now is 08:00 AM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration