Configuration

FreeBSD 2 網卡

  • March 21, 2013

我們有帶有 2 個帶有FreeBSD的網卡的伺服器。一張用於網際網路的卡(工作正常),另一張用於本地網路連接(到192.168.227.0/24網路)。當我嘗試使用 ip 192.168.227.1 ping 本地網路的網關時,我收到消息**“ping:發送到:主機已關閉。”** 網關正常且線上 - 所有其他伺服器(使用 Ubuntu)都可以輕鬆連接到該網路。所以也許我的配置文件中有一些錯誤。

如果配置:

igb0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
       options=1bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,              TSO4>
       ether 3c:d9:2b:f2:d1:f6
       media: Ethernet autoselect (1000baseT <full-duplex>)
       status: active
igb1: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
       options=1bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,              TSO4>
       ether 3c:d9:2b:f2:d1:f7
       media: Ethernet autoselect
       status: no carrier
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
       options=219b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,WOL_              MAGIC>
       ether 00:26:55:ea:e3:a6
       inet 77.195.133.102 netmask 0xffffffe0 broadcast 77.195.133.127
       media: Ethernet autoselect (1000baseT <full-duplex>)
       status: active
em1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
       options=19b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4>
       ether 00:26:55:ea:e3:a7
       inet 192.168.227.24 netmask 0xffffff00 broadcast 192.168.227.255
       media: Ethernet autoselect (1000baseT <full-duplex>)
       status: active
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
       options=3<RXCSUM,TXCSUM>
       inet6 fe80::1%lo0 prefixlen 64 scopeid 0x5
       inet6 ::1 prefixlen 128
       inet 127.0.0.1 netmask 0xff000000
       nd6 options=3<PERFORMNUD,ACCEPT_RTADV>

網路統計 -r

Routing tables

Internet:
Destination        Gateway            Flags    Refs      Use  Netif Expire
default            77.195.133.97      UGS         9  2874633    em0
10.6.200.0         192.168.227.1      UGS         0        0    em1
77.195.133.96/27   link#3             U           3  3808304    em0
77.195.133.102     link#3             UHS         0        0    lo0
localhost          link#5             UH          0     2101    lo0
192.168.227.0      link#4             U           0       59    em1
192.168.227.24     link#4             UHS         0        0    lo0

Internet6:
Destination        Gateway            Flags      Netif Expire
localhost          localhost          UH          lo0
fe80::%lo0         link#5             U           lo0
fe80::1%lo0        link#5             UHS         lo0
ff01:5::           fe80::1%lo0        U           lo0
ff02::%lo0         fe80::1%lo0        U           lo0

/etc/rc.conf

defaultrouter="77.195.133.97"
hostname="bd-mor-online.myhost.ru"
ifconfig_em0="inet 77.195.133.102 netmask 255.255.255.224"
ifconfig_em1="inet 192.168.227.24 netmask 255.255.255.0"
static_routes="net1 net2"
route_net1="-net 192.168.227.0/24 192.168.227.1"
route_net2="-net 10.6.200.0/24 192.168.227.1"
keymap="ru.koi8-r"
sshd_enable="YES"
inetd_enable="YES"
linux_enable="YES"

ping -c5 192.168.227.24 可以 - 100%。

還有網路10.6.200.0我需要通過192.168.227.1路由此伺服器,但主要目標是從網關獲取 PING

您需要使用以下設置打開 ip forwarding/etc/rc.conf

網關啟用=“是”

引用自:https://serverfault.com/questions/489957