PC (fl350) をルータに仕立てる(2)

構成図(2)の 場合

歓迎猫 歓迎猫

続いて fl350 の 場合を みてみよう、続にいうネットワークカードの 2枚 差しというものです、fl350 B の 条件を 見ることにしよう。


lx:~# ifconfig -a
eth0      Link encap:Ethernet  HWaddr 00:00:E2:13:92:57  
          inet addr:192.168.0.5  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:123 errors:0 dropped:0 overruns:0 frame:0
          TX packets:130 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100 
          RX bytes:60964 (59.5 Kb)  TX bytes:12787 (12.4 Kb)
          Interrupt:9 

eth1      Link encap:Ethernet  HWaddr 00:90:FE:23:46:32  
          inet addr:192.168.2.20  Bcast:192.168.2.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:142 errors:0 dropped:0 overruns:0 frame:0
          TX packets:110 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100 
          RX bytes:13625 (13.3 Kb)  TX bytes:59809 (58.4 Kb)
          Interrupt:10 Base address:0x2400 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:49 errors:0 dropped:0 overruns:0 frame:0
          TX packets:49 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:3294 (3.2 Kb)  TX bytes:3294 (3.2 Kb)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lx:~# netstat -rn
Kernel IP routing table
Destination  Gateway      Genmask        Flags MSS Window irtt Iface
192.168.2.0  0.0.0.0      255.255.255.0  U       0 0         0 eth1
192.168.0.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.0.1  0.0.0.0        UG      0 0         0 eth0

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lx:~# cat /etc/HOSTNAME
lx.bcnet.ne.jp
~~~~~~~~~~~~~~~~~~~~~~~
lx:~# cat /etc/resolv.conf
search bcnet.ne.jp 
nameserver 127.0.0.1
nameserver 192.168.0.1
~~~~~~~~~~~~~~~~~~~~~~~~~~
nl:~# sed /^#/d /etc/hosts
127.0.0.1       localhost
192.168.0.5     lx.bcnet.ne.jp lx

(ここの hosts、 resolv.confは最終のものとは、異 なっております、調整試験の為、吟味していないということです。動けば良い。) 次は少し長いが/etc/rc.d/rc.inet1 の 内容 です。御ゆっくりど うぞ、急ぐ人は、飛ばして下さい。


#! /bin/sh
#
# rc.inet1      This shell script boots up the base INET system.
#
# Version:      @(#)/etc/rc.d/rc.inet1  1.01    05/27/93
#

HOSTNAME=`cat /etc/HOSTNAME`

# Attach the loopback device.
/sbin/ifconfig lo 127.0.0.1
/sbin/route add -net 127.0.0.0 netmask 255.0.0.0 lo

if [ -f /var/run/inet1-scheme ] ; then
  INET1_SCHEME=`cat /var/run/inet1-scheme`
else
  INET1_SCHEME="fixed"
fi
if [ "$INET1_SCHEME" = "fixed" ] ; then

  # IF YOU HAVE AN ETHERNET CONNECTION, \
use these lines below to configure the
 
  # eth0 interface. If you're only using \
loopback or SLIP, don't include the
  # rest of the lines in this file.

  # Edit for your setup.
  IPADDR="192.168.0.5"          \
# REPLACE with YOUR IP address!
  NETMASK="255.255.255.0"               \
# REPLACE with YOUR netmask!
  NETWORK="192.168.0.0"         \
# REPLACE with YOUR network address!
  BROADCAST="192.168.0.255"     \
# REPLACE with YOUR broadcast address, if you
                                \
# have one. If not, leave blank and edit below
.
  GATEWAY="192.168.0.1"         \
# REPLACE with YOUR gateway address!
  # Uncomment the line below to \
configure your ethernet card.
  /sbin/ifconfig eth0 ${IPADDR} \
broadcast ${BROADCAST} netmask ${NETMASK}

  # Edit for your setup.
  IPADDR="192.168.2.20"         \
# REPLACE with YOUR IP address!
  NETMASK="255.255.255.0"       \
        # REPLACE with YOUR netmask!
  NETWORK="192.168.2.0"         \
# REPLACE with YOUR network address!
  BROADCAST="192.168.2.255"     \
# REPLACE with YOUR broadcast address, if you
                                \
# have one. If not, leave blank and edit below
.
#  GATEWAY="192.168.0.1"                \
# REPLACE with YOUR gateway address!

  # Uncomment the line below \
to configure your ethernet card.
  /sbin/ifconfig eth1 ${IPADDR} \
broadcast ${BROADCAST} netmask ${NETMASK}

  # If the line above is uncommented, \
the code below can also be uncommented.
  # It sees if the ethernet was properly \
initialized, and gives the admin some
  # hints about what to do if it wasn't.
  if [ ! $? = 0 ]; then
    cat << END
Your ethernet card was not initialized properly.  \
Here are some reasons why th
is
may have happened, and the solutions:
1. Your kernel does not contain support for your card.  \
Including all the 
   network drivers in a Linux kernel can make it \
too large to even boot, and
   sometimes including extra drivers can \
cause system hangs.  To support your
   ethernet, either edit /etc/rc.d/rc.modules \
to load the support at boottime,
   or compile and install a kernel \
that contains support.
2. You don't have an ethernet card, \
in which case you should comment out this
   section of /etc/rc.d/rc.inet1.  \
(Unless you don't mind seeing this error...
)
END
  fi
  # Uncomment these to set up your IP routing table.
  # /sbin/route add -net ${NETWORK} netmask ${NETMASK} eth0
  if [ ! "$GATEWAY" = "" ]; then
   /sbin/route add default gw ${GATEWAY} netmask 0.0.0.0 metric 1
  fi
elif [ "$INET1_SCHEME" = "dhcp" -o "$INET1_SCHEME" = "DHCP" ]\
 ; then
  if [ -x /sbin/dhcpcd ] ; then
    /sbin/dhcpcd
  else
    cat << END
Dhcpcd was not found.
Please install dhcpcd.
END
  fi
fi
# add one line add Sun Jun 27 23:48:54 JST 2004
echo 1 > /proc/sys/net/ipv4/ip_forward
# End of rc.inet1

最後のところに ”echo 1 > /proc/sys/net/ipv4/ip_forward”の項目がある ことに留意されたいここで eth0 eth1 の 通過を 設定している。これが fl350 の 設定内容である。ping 試験は割愛します。にゃんたろうは うまく出来たと だけ申しそえておきます。次は adsl-router の 設定です。画面が非常に重たい のを予めお断りもうしておきます。


前へ

前へ

次へ

次へ


上に

上に


Copyright © 2004.-2007. nyantarou All Rights Reserved.