文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>如何在Gentoo上安装一个路由(转载)

如何在Gentoo上安装一个路由(转载)

时间:2010-03-30  来源:vitaminch

Assuming you've already got the system setup and running correctly we will start with kernel configuration. Don't freak out it's not that hard to do.

cd /usr/src/linux
make menuconfig

You should be at a screen with a few options. Navigate the screen as follows:

Networking --> Network options -->
[*] TCP/IP networking
<*> IP: advanced router
Scroll down about to
[*] Network packet filtering (replaces ipchains)
Star it hit enter and go to
IP: Netfilter Configuration
[*] Connection tracking (required for masq/NAT)
<*> FTP protocol support
<*> IRC protocol support
[*] IP tables support (required for filtering/masq/NAT)
<*> IP range match support
<*> Packet filtering
[*] Full NAT
<*> MASQUERADE target support
[s] Packet mangling
Networking Network options
QoS and/or fair queueing
[*] QoS and/or fair queueing
<*> Hierarchical Token Bucket (HTB)
<*> Ingress Qdisc
Device Drivers
Network device support
[*] PPP (point-to-point protocol) support
<*> PPP filtering
<*> PPP support for async serial ports
<*> PPP support for sync tty ports
<*> PPP Deflate compression
<*> PPP BSD-Compress compression
<*> PPP over Ethernet

Click exit all the way out until it asks you to save. Click yes to save and in terminal type:

make && make modules_install

Yup you're officially compiling the kernel. Get some food or something because depending on your system it might take a while :). When that is done compiling, copy the binary to /boot with:

cp arch/i386/boot/bzImage /boot/kernel-2.6.17-gentoo-r5

Obviously you'll need to use the name of your old kernel, as that might not be the name of yours. Now from here the steps are different depending on how you connect to the internet. I use cable so I don't have to worry about PPPoE. I'll go over a cable setup first. If you don't have it already you will need dhcpcd.

emerge dhcpcd

Then you'll need to make another interface for your second nic by using a symbolic link, and make them all start on boot.

ln -s net.lo /etc/init.d/net.eth1
rc-update add net.eth1 default
rc-update add net.eth0 default

If you're using DSL/PPPoE you'll need to do this: (Straight from gentoo handbook)

# nano /etc/ppp/pap-secrets
# client server secret
"vla9h924" * "password"
# nano /etc/conf.d/net
Tell baselayout to use adsl for your eth1:
config_eth1=( "adsl" )
user_eth1=( "vla9h924" )
(Replace 'vla9h924' with your username and 'password' with your password)

Next you'll need to configure your LAN and WAN interface. I used eth1 as WAN and eth0 as LAN. To do this we need to configure /etc/conf.d/net

For a dynamic or even semi static (Comcast users):
config_eth1=( "dhcp" )
Static IP: (From gentoo manual never used a static IP)
config_eth1=( "66.92.78.102 broadcast 66.92.78.255 netmask 255.255.255.0" )
routes_eth1=( "default gw 66.92.78.1" )
And finally both users must add:
config_eth0=( "192.168.1.1 broadcast 192.168.1.255 netmask 255.255.255.0" )

Almost done, all we need is a firewall to protect us since we are wide open on the internet, and some NAT rules to forward traffic.

cd /etc/init.d/
wget http://cyber-knowledge.net/blog/extras/firewall
wget http://cyber-knowledge.net/blog/extras/natrouting
chmod 700 natrouting
chmod 700 firewall
rc-update add firewall default
rc-update add natrouting default

Double check those scripts to make sure everything is correct for your LAN/WAN in there. Hook up the cables so that the one coming from your modem is in the WAN port, and the one from your LAN port is going into the LAN port of a switch or your old router. Usually the WAN port on a switch is separated from the rest. If you plug more LAN cables in to that switch, all computers will have internet. If you're using your old router make sure you change your old routers IP to 192.168.1.2 or something before using it as a switch. Reboot your computer and everything should start fine. The WAN interface should have gotten an external IP while the LAN should have gotten 192.168.1.1. If not, restart your modem by unplugging it and plugging it back in. Then restart the WAN interface by doing:

/etc/init.d/net.eth1 restart

Hopefully it worked that time. Keep in mind all PCs you hook up to the network will now have to be configured to use a static IP address. For more information on that see the Microsoft website. Some hints while doing it. The IP can be 192.168.1.100 through .255. The default gateway is 192.168.1.1. Your subnet mask should fill in automatically. The name server can be found in /etc/resolv.conf of your router or you can use 4.2.2.1. With all luck you have internet and a much faster router :D. Have fun, and comment if this worked for you or you had any issues.

相关阅读 更多 +
排行榜 更多 +
试着飞手游下载

试着飞手游下载

休闲益智 下载
血染小镇(功能菜单)中文版下载

血染小镇(功能菜单)中文版下载

飞行射击 下载
泰坦之旅高爆版下载

泰坦之旅高爆版下载

角色扮演 下载