⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 linux-multiple-ethernet.html

📁 Linus guide, Linus guide, Linus guide,
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 FINAL//EN"><HTML><HEAD><TITLE>Setting Up Multiple Ethernet Cards</TITLE>	<META NAME="Author" CONTENT="Matrix">	<META NAME="Description" CONTENT="How to set up multiple Ethernet cards.">	<META NAME="Keywords" CONTENT="Linux, multiple, ethernet, masquerading"></HEAD><BODY BGCOLOR="#FFFFFF" TEXT="#000000"><H2>Setting Up Multiple Ethernet Cards</H2><FONT SIZE="-1"><B>Written by Matrix (<A HREF="mailto:matrix@moon.jic.com">matrix@moon.jic.com</A>)</B></FONT><BR><FONT SIZE="-1"><B>Last updated: June 10, 1998</B></FONT><P>The first thing you do is, obviously, put your card into your systemand set the IRQ and address jumper. Take note of the settings on eachcard. You must have the modules installed for your card. (by default, RedHat 5.0 has the modules for most cards). After you have your modulesinstalled and know the name of it, type <B>/sbin/insmod (modName)</B>,where (modName) is the module's name.</P><P>For example, when I type <B>/sbin/insmod smc-ultra</B> I get a messagesaying &quot;eth1 loaded&quot; along with my card's IRQ and I/O address.By default, the kernel already detects one of your cards on bootup, thenyou go to your /etc/ directory (<B> cd /etc</B>) and edit<TT>lilo.conf</TT> (<B>pico lilo.conf</B>). After that, insert thefollowing line after the &quot;label&quot; line:</P><PRE>append = &quot;ether=(IRQ),(IO),0,0,eth0 ether=(IRQ),(IO),0,0,eth1&quot;</PRE><P>Here's what it might look like:</P><PRE>image=/boot/vmlinuz-2.0.32        label=linux   ---> append = "ether=3,0x280,0,0,eth0 ether=10,0x300,0,0,eth1" <--        root=/dev/sda2        initrd=/boot/initrd-2.0.32.img        read-write</PRE><P>Then you want to edit the conf.modules file in the /etc/ directory(<B>pico /etc/config.modules</B>). Add the lines:</P> <PRE>alias eth0 (modName)alias eth1 (modName)</PRE><P>It might look something like this:</P><PRE>alias eth0 smc-ultraalias eth1 wd </PRE><P>This sets the module's name to the ethernet card interface(eth0,eth1).</P><P>Now you want to make sure your network file is set propperly. Go to the/etc/sysconfig and edit the network file (<B>pico/etc/sysconfig/network</B>).</P><PRE>NETWORKING=yesFORWARD_IPV4=yesHOSTNAME=my.domain.name.comDOMAINNAME=domain.name.comGATEWAY=XXX.XXX.XXX.XXX your gatewayGATEWAYDEV=eth0 <-- the interface you want to use for this gateways (orethernet card)</PRE><P>Now you go into your /etc/sysconfig/network-scripts directory and copythe ifcfg-eth0 file to ifcfg-eth1 (<B>cp/etc/sysconfig/network-scripts/ifcfg-eth0/etc/sysconfig/network-scripts/ifcfg-eth1</B>). Edit both files and setyour IP address accordingly (I use eth0 to connect to the cable modem sothe ifcfg-eth0 file should have its IP address set for the cable (<B>pico/etc/sysconfig/network-scripts/ifcfg-eth0</B>).</P><P>It should look something like this:</P><PRE>DEVICE=eth0 <-- says wha ethernet card is using this settingIPADDR=XXX.XXX.XXX.XXX <--- your IP address setting for your Cable modemNETMASK=255.255.255.0NETWORK=XXX.XXX.XXX.0 the XXX,s should be the same as your IP address aboveBROADCAST=XXX.XXX.XXX.255ONBOOT=yesBOOTPROTO=bootpUSERCTL=no</PRE><P>Now edit the ifcfg-eth1 file (<B>pico /etc/sysconfig/network-scripts/ifcfg-eth1</B>).</P><PRE>DEVICE=eth1 <-- says wha ethernet card is using this settingIPADDR=192.168.1.X <--- your IP address setting for your local network)NETMASK=255.255.255.0NETWORK=XXX.XXX.XXX.0 the XXX,s should be the same as your IP address aboveBROADCAST=XXX.XXX.XXX.255ONBOOT=yesBOOTPROTO=bootpUSERCTL=no</PRE><P>Now reboot and look to see if both card are initialized. A way to findthis out is to run the &quot;ifconfig&quot; command after you haverebooted. Type <B>/sbin/ifconfig</B> as any user.</P><P>If you see both eth0 and eth1 settings there, your cards are working.It's a step in the right direction. Thats about as far as I made it butI'm still working on it.</P><P>By the way, you must set your other computers' IP address. The gatewayyou will be using for those are the same IP address that you assigned yourlinux machine. Make the IP address for your Windows machine something like192.168.1.5 and gateway 192.168 .1.X (whatever you told it to be in theifcfg-eth1 file).</P><P>Now, some quick IP masquerade instructions. Just cut and paste them tosee if it works for you.</P><PRE>echo "1" > /proc/sys/net/ipv4/ip_forward	[hit enter]/sbin/depmod -a	[hit enter]/sbin/modprobe ip_masq_ftp	[press enter]/sbin/modprobe ip_masq_raudio	[press enter]/sbin/modprobe ip_masq_irc	[press enter]/sbin/modprobe ip_masq_cuseeme	[press enter]/sbin/modprobe ip_masq_vdolive	[press enter]ipfwadm -F -p deny	[press enter]ipfwadm -F -a m -S 192.168.1.0/24 -D 0.0.0.0/0	[hit enter]ipfwadm -I -a accept -S 0/0 68 -D 0/0 67 -W bootp_clients_net_if_name -P udp	[hit enter]</PRE><P>I know this works if you have a dialup connection to the Internet and aLAN setup already. With this you should be able to connect to the Linuxbox and go on the Internet at the same time. I am currently writing stepson getting this method to work wit h a cable modem.</P><HR><P>Comments, questions, suggestions? Send them to Matrix at <AHREF="mailto:matrix@moon.jic.com">matrix@moon.jic.com</A>.</P><HR><HR><P><B><FONT SIZE="-1">Copyright &copy; 1997-1998 <AHREF="mailto:matrix@moon.jic.com">Matrix (matrix@moon.jic.com)</A>. Allrights reserved. Permission to use, distribute, and copy this document ishereby granted. You may modify this document as long as credit to me isgiven.</FONT></B></P></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -