|
楼主 |
发表于 2007-2-8 01:33:42
|
显示全部楼层
Post by xiaokang
ifconfig 先看下网卡能认出来么
然后贴你的IP地址、掩码、网关、DNS出来看看
猫开了路由功能后,比如说猫的IP地址为192.168.1.1,你本机的网关设成192.168.1.1,IP地址192.168.1.100等等。。。
Sorry,这几天一直没有空上linuxsir转。下面贴出那台机器的信息:
- [color="Red"]#ifconfig eth0[/color]
- eth0 Link encap:Ethernet HWaddr 00:0A:EB:82:5F:58
- inet addr:192.168.1.15 Bcast:192.168.1.255 Mask:255.255.255.0
- UP BROADCAST MULTICAST MTU:1500 Metric:1
- RX packets:0 errors:0 dropped:0 overruns:0 frame:0
- TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
- collisions:0 txqueuelen:1000
- RX bytes:0 (0.0 b) TX bytes:720 (720.0 b)
- Interrupt:10 Base address:0xd000
- [color="red"]#route -FC[/color]
- Kernel IP routing table
- Destination Gateway Genmask Flags Metric Ref Use Iface
- localnet * 255.255.255.0 U 0 0 0 eth0
- loopback * 255.0.0.0 U 0 0 0 lo
- default 192.168.1.1 0.0.0.0 UG 1 0 0 eth0
- Kernel IP routing cache
- Source Destination Gateway Flags Metric Ref Use Iface
- slackware.gavin 202.96.134.133 192.168.1.1 0 0 0 eth0
- slackware.gavin 202.96.134.133 192.168.1.1 0 0 0 eth0
- slackware.gavin slackware.gavin slackware.gavin l 0 0 1 lo
- [color="red"]#route -n[/color]
- Kernel IP routing table
- Destination Gateway Genmask Flags Metric Ref Use Iface
- 192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
- 127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
- 0.0.0.0 192.168.1.1 0.0.0.0 UG 1 0 0 eth0
复制代码
另外,文件夹\etc\rc.d下关于internet的文件内容如下:
- [color="red"]#vi rc.inet1.conf[/color]
- # /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 ("").
- # You can configure network interfaces other than eth0,eth1... by setting
- # IFNAME[interface] to the interface's name. If IFNAME[interface] is unset
- # or empty, it is assumed you're configuring eth<interface>.
- # Several other parameters are available, the end of this file contains a
- # comprehensive set of examples.
- # =============================================================================
- # Config information for eth0:
- IPADDR[0]="192.168.1.15"
- NETMASK[0]="255.255.255.0"
- DHCP_HOSTNAME[0]=""
- # Config information for eth1:
- IPADDR[1]=""
- NETMASK[1]=""
- USE_DHCP[1]=""
- 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="192.168.1.1"
- # 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"
- ## Example config information for wlan0. Uncomment the lines you need and fill
- ## in your info. (You may not need all of these for your wireless network)
- #IFNAME[4]="wlan0"
- #IPADDR[4]=""
- #NETMASK[4]=""
- #USE_DHCP[4]="yes"
- #DHCP_HOSTNAME[4]="icculus-wireless"
- #DHCP_KEEPRESOLV[4]="yes"
- #DHCP_KEEPNTP[4]="yes"
- #DHCP_KEEPGW[4]="yes"
- #DHCP_IPADDR[4]=""
- #WLAN_ESSID[4]=BARRIER05
- #WLAN_MODE[4]=Managed
- ##WLAN_RATE[4]="54M auto"
- ##WLAN_CHANNEL[4]="auto"
- ##WLAN_KEY[4]="D5AD1F04ACF048EC2D0B1C80C7"
- ##WLAN_IWPRIV[4]="AuthMode=WPAPSK EncrypType=TKIP WPAPSK=7B1ABEEB5D197741923ED26727569C365E31212096A0EAFAD563B268BAD01CAF TxRate=0"
- #WLAN_WPA[4]="wpa_supplicant"
- #WLAN_WPADRIVER[4]="ndiswrapper"
- ## Some examples of additional network parameters that you can use.
- ## Config information for wlan0:
- #IFNAME[4]="wlan0" # Use a different interface name nstead of
- # the default 'eth4'
- #HWADDR[4]="00:01:23:45:67:89" # Overrule the card's hardware MAC address
- #MTU[4]="" # The default MTU is 1500, but you might need
- # 1360 when you use NAT'ed IPSec traffic.
- #DHCP_KEEPRESOLV[4]="yes" # If you dont want /etc/resolv.conf overwritten
- #DHCP_KEEPNTP[4]="yes" # If you don't want ntp.conf overwritten
- #DHCP_KEEPGW[4]="yes" # If you don't want the DHCP server to change
- # your default gateway
- #DHCP_IPADDR[4]="" # Request a specific IP address from the DHCP
- # server
- #WLAN_ESSID[4]=DARKSTAR # Here, you can override _any_ parameter
- # defined in rc.wireless.conf, by prepending
- # 'WLAN_' to the parameter's name. Useful for
- # those with multiple wireless interfaces.
- #WLAN_IWPRIV[4]="AuthMode=WPAPSK EncrypType=TKIP WPAPSK=thekey TxRate=0"
- # Some drivers require a private ioctl to be
- # set through the iwpriv command. If more than
- # one is required, you can place them in the
- # IWPRIV parameter (space-separated, see the
- # example).
复制代码
- [color="red"]#vi rc.inet2[/color]
- #!/bin/sh
- #
- # rc.inet2 This shell script boots up the entire network system.
- # Note, that when this script is used to also fire
- # up any important remote NFS disks (like the /usr
- # directory), care must be taken to actually
- # have all the needed binaries online _now_ ...
- #
- # Uncomment or comment out sections depending on which
- # services your site requires.
- #
- # Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
- # Modified for Slackware by Patrick Volkerding <volkerdi@slackware.com>
- # At this point, we are ready to talk to The World...
- # Mount remote (NFS) filesystems:
- if cat /etc/fstab | grep -v '^#' | grep -w nfs 1> /dev/null 2> /dev/null ; then
- # Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS
- # volumes defined in /etc/fstab since these will need to be running in order
- # to mount them. If they are not running, attempting to mount an NFS
- # partition will cause mount to hang, or at least result in unreliable
- # operation. Keep this in mind if you plan to mount unlisted NFS
- # partitions...
- # If you have uncommented NFS partitions in your /etc/fstab, rc.rpc is run
- # whether it is set as executable or not. If you don't want to run it,
- # comment the NFS partitions out in /etc/fstab or erase/rename rc.rpc.
- if [ -r /etc/rc.d/rc.rpc ]; then
- sh /etc/rc.d/rc.rpc start
- fi
- echo "Mounting remote (NFS) file systems: /sbin/mount -a -t nfs"
- /sbin/mount -a -t nfs # This may be our /usr runtime!
- # Show the mounted volumes:
- /sbin/mount -v -t nfs
- fi
- # If /etc/rc.d/rc.rpc is executable, run it to load rpc.portmap, rpc.lockd,
- # and rpc.statd. This might be needed to mount NFS partitions that are not
- # listed in /etc/fstab. Starting this twice won't hurt as the script will
- # check if things are already running before trying to start them.
- if [ -x /etc/rc.d/rc.rpc ]; then
- sh /etc/rc.d/rc.rpc start
- fi
- # Mount remote (SMB) filesystems:
- if cat /etc/fstab | grep -v '^#' | grep -w smbfs 1> /dev/null 2> /dev/null ; then
- echo "Mounting remote (SMB) file systems: /sbin/mount -a -t smbfs"
- /sbin/mount -a -t smbfs
- # Show the mounted volumes:
- /sbin/mount -v -t smbfs
- fi
- # Start the system logger if it is not already running (maybe because /usr
- # is on a network partition).
- if [ -x /etc/rc.d/rc.syslog -a -d /var/log -a ! -r /var/run/syslogd.pid ]; then
- . /etc/rc.d/rc.syslog start
- fi
- # If there is a firewall script, run it before enabling packet forwarding.
- # See the HOWTOs on http://www.netfilter.org/ for documentation on
- # setting up a firewall or NAT on Linux. In some cases this might need to
- # be moved past the section below dealing with IP packet forwarding.
- if [ -x /etc/rc.d/rc.firewall ]; then
- /etc/rc.d/rc.firewall start
- fi
- # Turn on IPv4 packet forwarding support.
- if [ -x /etc/rc.d/rc.ip_forward ]; then
- . /etc/rc.d/rc.ip_forward start
- fi
- # Start the inetd server:
- if [ -x /etc/rc.d/rc.inetd ]; then
- /etc/rc.d/rc.inetd start
- fi
- # Start the OpenSSH SSH daemon:
- if [ -x /etc/rc.d/rc.sshd ]; then
- echo "Starting OpenSSH SSH daemon: /usr/sbin/sshd"
- /etc/rc.d/rc.sshd start
- fi
- # Start the BIND name server daemon:
- if [ -x /etc/rc.d/rc.bind ]; then
- /etc/rc.d/rc.bind start
- fi
- # Start NIS (the Network Information Service):
- if [ -x /etc/rc.d/rc.yp ]; then
- . /etc/rc.d/rc.yp start
- fi
- # Start the NFS server. Note that for this to work correctly, you'll
- # need nfsd support in the kernel (the startup script will try to load
- # the module for you).
- # You'll also need to set up some shares in /etc/exports.
- # Starting the NFS server:
- if [ -x /etc/rc.d/rc.nfsd ]; then
- /etc/rc.d/rc.nfsd start
- fi
- # Stuff you won't need follows. ;-)
- # # Start the network routing daemon:
- # if [ -x /usr/sbin/routed ]; then
- # echo "Starting network routing daemon: /usr/sbin/routed"
- # /usr/sbin/routed -g -s
- # fi
- # # Start the system status server:
- # if [ -x /usr/sbin/rwhod ]; then
- # echo "Starting system status server: /usr/sbin/rwhod"
- # /usr/sbin/rwhod
- # fi
- # # Fire up the PC-NFS daemon(s). This is a primarily obsolete system, and may
- # # not be very secure. It's not at all needed for normal NFS server support.
- # # You probably should not run this.
- # if [ -x /usr/sbin/rpc.pcnfsd ]; then
- # echo "Starting PC-NFS daemons: /usr/sbin/rpc.pcnfsd /usr/sbin/rpc.bwnfsd"
- # /usr/sbin/rpc.pcnfsd /var/spool/lpd
- # fi
- # if [ -x /usr/sbin/rpc.bwnfsd ]; then
- # /usr/sbin/rpc.bwnfsd /var/spool/lpd
- # fi
复制代码
- [color="red"]#vi rc.inetd[/color]
- #!/bin/sh
- # Start/stop/restart inetd, the BSD Internet super-daemon.
- # Start inetd:
- inetd_start() {
- if [ -x /usr/sbin/inetd ]; then
- echo "Starting Internet super-server daemon: /usr/sbin/inetd"
- /usr/sbin/inetd
- fi
- }
- # Stop inetd:
- inetd_stop() {
- killall inetd
- }
- # Restart inetd:
- inetd_restart() {
- inetd_stop
- sleep 1
- inetd_start
- }
- case "$1" in
- 'start')
- inetd_start
- ;;
- 'stop')
- inetd_stop
- ;;
- 'restart')
- inetd_restart
- ;;
- *)
- echo "usage $0 start|stop|restart"
- esac
复制代码
- [color="Red"]#vi rc.ip_forward[/color]
- #!/bin/sh
- # /etc/rc.d/rc.ip_forward: start/stop IP packet forwarding
- #
- # If you intend to run your Linux box as a router, i.e. as a
- # computer that forwards and redistributes network packets, you
- # will need to enable IP packet forwarding in your kernel.
- #
- # To activate IP packet forwarding at boot time, make this
- # script executable: chmod 755 /etc/rc.d/rc.ip_forward
- #
- # To disable IP packet forwarding at boot time, make this
- # script non-executable: chmod 644 /etc/rc.d/rc.ip_forward
- # Start IP packet forwarding:
- ip_forward_start() {
- if [ -f /proc/sys/net/ipv4/ip_forward ]; then
- echo "Activating IPv4 packet forwarding."
- echo 1 > /proc/sys/net/ipv4/ip_forward
- fi
- # When using IPv4 packet forwarding, you will also get the
- # rp_filter, which automatically rejects incoming packets if the
- # routing table entry for their source address doesn't match the
- # network interface they're arriving on. This has security
- # advantages because it prevents the so-called IP spoofing,
- # however it can pose problems if you use asymmetric routing
- # (packets from you to a host take a different path than packets
- # from that host to you) or if you operate a non-routing host
- # which has several IP addresses on different interfaces. To
- # turn rp_filter off, uncomment the lines below:
- #if [ -r /proc/sys/net/ipv4/conf/all/rp_filter ]; then
- # echo "Disabling rp_filter."
- # echo 0 > /proc/sys/net/ipv4/conf/all/rp_filter
- #fi
- }
- # Stop IP packet forwarding:
- ip_forward_stop() {
- if [ -f /proc/sys/net/ipv4/ip_forward ]; then
- echo "Disabling IPv4 packet forwarding."
- echo 0 > /proc/sys/net/ipv4/ip_forward
- fi
- }
- # Restart IP packet forwarding:
- ip_forward_restart() {
- ip_forward_stop
- sleep 1
- ip_forward_start
- }
- case "$1" in
- 'start')
- ip_forward_start
- ;;
- 'stop')
- ip_forward_stop
- ;;
- 'restart')
- ip_forward_restart
- ;;
- *)
- echo "usage $0 start|stop|restart"
- esac
复制代码
注:红色部分表示打入的命令 |
|