Results 1 to 4 of 4
Hello,
Im new with Slackware and before this Im always stick to my RH but im not an expert on Linux. Ok my problem is how can I re-configure my ...
- 04-13-2005 #1Just Joined!
- Join Date
- Apr 2005
- Location
- Malaysia
- Posts
- 1
How to configure 2 NIC in Slcakware?
Hello,
Im new with Slackware and before this Im always stick to my RH but im not an expert on Linux. Ok my problem is how can I re-configure my NICs? Im using slackware 7 with 2 Realtek Networkcard. My slack does detect both NIC but I need to configure my eth0 and eth1. I need to set DHCP to one of my NIC and set an IP as a gateway server to the other one. As for now I only set one of them a client ip. Which filw should I edit?? Thanks
snc:~$ /sbin/ifconfig
eth0 Link encap:Ethernet HWaddr 00:30:4F:21:F0:28
inet addr:192.168.1.222 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:95 errors:0 dropped:0 overruns:0 frame:0
TX packets:68 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
Interrupt:10 Base address:0xe000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:3924 Metric:1
RX packets:18 errors:0 dropped:0 overruns:0 frame:0
TX packets:18 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
snc:~$ /sbin/ifconfig eth1
eth1 Link encap:Ethernet HWaddr 00:00:E8:53:3F:A7
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
Interrupt:7 Base address:0xe400
snc:~$
- 04-15-2005 #2Linux Guru
- Join Date
- May 2004
- Location
- forums.gentoo.org
- Posts
- 1,814
I just did this last night with Slackware 8.1. I guess we're both a little behind the curve. My reference is home network mini-HOWTO from The Linux Documentation Project:
Edit /etc/modules.conf:
Both of my NICs use driver 3c509: change this to match your hardware. io base address and irq both can be found from doing 'ifconfig eth0' and 'ifconfig eth1'.Code:alias eth0 3c509 alias eth1 3c509 options 3c509 io=0x220,0x230 irq=5,10
/IMHO
//got nothin'
///this use to look better
- 04-18-2005 #3Just Joined!
- Join Date
- Mar 2005
- Location
- Stockholm - Sweden
- Posts
- 4
You can edit
then just restart the network.Code:$/etc/rc.d/rc.inet1.conf
Code:$/etc/rc.d/./rc.inet1 restart
- 04-18-2005 #4This is true for Slackware 9.1 and up or so, but older versions did not come with scripts supporting multiple interfaces. So you have to edit your /etc/rc.d/rc.inet1 script to reflect your configuration, or add a line to the rc.local script.
Originally Posted by MeatAbstract
Here is a copy of a I believe 9.1 version of rc.inet1:
And an example of a rc.inet1.conf file:Code:#! /bin/sh # /etc/rc.d/rc.inet1 # This script is used to bring up the various network interfaces. # # @(#)/etc/rc.d/rc.inet1 9.1 Tue Aug 26 13:34:58 PDT 2003 (pjv) ############################ # READ NETWORK CONFIG FILE # ############################ # Get the configuration information from /etc/rc.d/rc.inet1.conf: . /etc/rc.d/rc.inet1.conf ###################### # LOOPBACK FUNCTIONS # ###################### # Function to bring up the loopback interface. If loopback is # already up, do nothing. lo_up() { if grep lo: /proc/net/dev 1> /dev/null ; then if ! /sbin/ifconfig | grep "^lo" 1> /dev/null ; then /sbin/ifconfig lo 127.0.0.1 /sbin/route add -net 127.0.0.0 netmask 255.0.0.0 lo fi fi } # Function to take down the loopback interface: lo_down() { if grep lo: /proc/net/dev 1> /dev/null ; then /sbin/ifconfig lo down fi } ###################### # ETHERNET FUNCTIONS # ###################### # Function to bring up an Ethernet interface. If the interface is # already up or does not yet exist (perhaps because the kernel driver # is not loaded yet), do nothing. eth_up() { # If the interface isn't in the kernel yet (but there's an alias for it in # modules.conf), then it should be loaded first: if ! grep eth${1}: /proc/net/dev 1> /dev/null ; then # no interface yet if /sbin/modprobe -c | grep -w "alias eth${1}" | grep -vw "alias eth${1} off" > /dev/null ; then /sbin/modprobe eth${1} fi fi if grep eth${1}: /proc/net/dev 1> /dev/null ; then # interface exists if ! /sbin/ifconfig | grep "eth${1} " 1> /dev/null ; then # interface not up if [ "${USE_DHCP[$1]}" = "yes" ]; then # use DHCP to bring interface up if [ ! "${DHCP_HOSTNAME[$1]}" = "" ]; then /sbin/dhcpcd -t 10 -h ${DHCP_HOSTNAME[$1]} -d eth${1} else /sbin/dhcpcd -t 10 -d eth${1} fi else # bring up interface using a static IP address if [ ! "${IPADDR[$1]}" = "" ]; then # skip unconfigured interfaces # Determine broadcast address from the IP address and netmask: BROADCAST=`/bin/ipmask ${NETMASK[$1]} ${IPADDR[$1]} | cut -f 1 -d ' '` # Set up the ethernet card: echo "Configuring eth${1}:" echo "/sbin/ifconfig eth${1} ${IPADDR[$1]} broadcast ${BROADCAST} netmask ${NETMASK[$1]}" /sbin/ifconfig eth${1} ${IPADDR[$1]} broadcast ${BROADCAST} netmask ${NETMASK[$1]} else if [ "$DEBUG_ETH_UP" = "yes" ]; then echo "eth${1} interface is not configured in /etc/rc.d/rc.inet1.conf" fi fi fi else if [ "$DEBUG_ETH_UP" = "yes" ]; then echo "eth${1} is already up, skipping" fi fi else if [ "$DEBUG_ETH_UP" = "yes" ]; then echo "eth${1} interface does not exist (yet)" fi fi } # Function to take down an Ethernet interface: eth_down() { if grep eth${1}: /proc/net/dev 1> /dev/null ; then if [ "${USE_DHCP[$1]}" = "yes" ]; then /sbin/dhcpcd -k -d eth${1} sleep 1 else /sbin/ifconfig eth${1} down fi fi } ##################### # GATEWAY FUNCTIONS # ##################### # Function to bring up the gateway if there is not yet a default route: gateway_up() { if ! /sbin/route | grep "^default" 1> /dev/null ; then if [ ! "$GATEWAY" = "" ]; then /sbin/route add default gw ${GATEWAY} metric 1 fi fi } # Function to take down an existing default gateway: gateway_down() { if /sbin/route | grep "^default" 1> /dev/null ; then /sbin/route del default fi } ############ ### MAIN ### ############ case "$1" in 'start') # "start" brings up all available interfaces: lo_up eth_up 0 eth_up 1 eth_up 2 eth_up 3 gateway_up ;; 'stop') # "stop" takes down all existing interfaces: gateway_down eth_down 3 eth_down 2 eth_down 1 eth_down 0 lo_down ;; *) # The default is to bring up all interfaces: lo_up eth_up 0 eth_up 1 eth_up 2 eth_up 3 gateway_up esac # End of /etc/rc.d/rc.inet1
This example configures an eth0 using dhcp (including default gateway) and an internal eth1 with a static address.Code:# /etc/rc.d/rc.inet1.conf # # This file contains the configuration settings for network interfaces. # If USE_DHCP[interface] is set to "yes", this overrides any other settings. # If you don't have an interface, leave the settings null (""). # Config information for eth0: IPADDR[0]="" NETMASK[0]="" USE_DHCP[0]="yes" DHCP_HOSTNAME[0]="" # Config information for eth1: IPADDR[1]="192.168.1.1" NETMASK[1]="255.255.255.0" USE_DHCP[1]="no" DHCP_HOSTNAME[1]="" # Config information for eth2: IPADDR[2]="" NETMASK[2]="" USE_DHCP[2]="" DHCP_HOSTNAME[2]="" # Config information for eth3: IPADDR[3]="" NETMASK[3]="" USE_DHCP[3]="" DHCP_HOSTNAME[3]="" # Default gateway IP address: GATEWAY="" # Change this to "yes" for debugging output to stdout. Unfortunately, # /sbin/hotplug seems to disable stdout so you'll only see debugging output # when rc.inet1 is called directly. DEBUG_ETH_UP="no"
I\'m so tired .....
#200472


Reply With Quote
