-

   aka-CnupT

 - e-mail

 

 -

 -

( : 1) _

 -

 LiveInternet.ru:
: 31.12.2007
: 58
: 204
: 535

:


FreeBSD

, 28 2008 . 07:00 +
-

FreeBSD :

FreeBSD ?


FreeBSD router ().

, :

Ethernet
є (/24 - 255.255.255.0)
FreeBSD

, 192.168.1.0/24 192.168.0.0/24.

FreeBSD () .

net.inet.ip.forwarding, :

[root@freebsd ~]# sysctl net.inet.ip.forwarding
net.inet.ip.forwarding: 0

0″, , FreeBSD .

:

[root@freebsd ~]# sysctl net.inet.ip.forwarding=1
net.inet.ip.forwarding: 0 -> 1

0″ 1″. , 1-. 2- :

/etc/rc.conf : gateway_enable=YES
/etc/sysctl.conf : net.inet.ip.forwarding=1
: em0 em1.

em0 , em1 . IP- FreeBSD :

[root@freebsd ~]# ifconfig em0 add 192.168.1.1/24
[root@freebsd ~]# ifconfig em1 add 192.168.0.1/24


--------------------------------------------------------------------------------
:

ifconfig :
command not found

[root@virus ~]# whereis ifconfig
ifconfig: /sbin/ifconfig /usr/share/man/man8/ifconfig.8.gz /usr/src/sbin/ifconfig
ifconfig
whereis ifconfig /sbin/ifconfig
ifconfig, command not found


--------------------------------------------------------------------------------
:

[root@freebsd ~]# ifconfig -a

em0: flags=8843 metric 0 mtu 1500
ether 00:02:a5:4e:92:48
inet 192.168.1.1 netmask 0xffffff00 broadcast 192.168.1.255
media: Ethernet autoselect (100baseTX )
status: active
em1: flags=8802 metric 0 mtu 1500
ether 00:02:a5:4e:92:49
inet 192.168.0.1 netmask 0xffffff00 broadcast 192.168.0.255
media: Ethernet autoselect (100baseTX )
status: active :

em0 em1 -
UP - , , ( : ifconfig _ up)
ether - mac-
inet - IP- broadcast
media -
status - . status: no carrier, , .

, IP- , /etc/rc.conf :

ifconfig_em0=inet 192.168.1.1 netmask 255.255.255.0″
ifconfig_em1=inet 192.168.0.1 netmask 255.255.255.0″

firewall, ipfw, :

ipfw add 100 allow ip from 192.168.1.1/24 to 192.168.0.1/24
ipfw add 110 allow ip from 192.168.1.0/24 to 192.168.1.1/24

:

IP- : 192.168.1. 192.168.0.
255.255.255.0
: 192.168.1. 192.168.1.1, 192.168.0. 192.168.0.1 ( IP- FreeBSD )
. 2- , IP-:

192.168.1.11
192.168.0.15
ping :

[root@freebsd ~]# ping 192.168.1.11

:

PING 192.168.1.11 (192.168.1.11): 56 data bytes
64 bytes from 192.168.1.11: icmp_seq=0 ttl=64 time=0.466 ms
64 bytes from 192.168.1.11: icmp_seq=1 ttl=64 time=0.238 ms
64 bytes from 192.168.1.11: icmp_seq=2 ttl=64 time=0.272 ms
^C
192.168.1.11 ping statistics
3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.238/0.325/0.466/0.100 ms

. 192.168.0.15.

ping , IP- , .

.

ping, IP- 192.168.1.11:

ping 192.168.0.15

, .

, tracert ( Windows) traceroute ( FreeBSD):

tracert 192.168.0.15

:

1 * * *

.

:

1 192.168.1.1 (192.168.1.1) 0.421 ms 0.447 ms 0.485 ms
2 * * *

, firewall IP- 192.168.0.15 ( IP-, , ping )

, ? tcpdump , :

[root@freebsd ~]# tcpdump -ni em0

[root@freebsd ~]# tcpdump -ni em1

( ) tcpdump , :

[root@freebsd ~]# tcpdump -ni em0

12:17:23.398376 IP 192.168.1.11 > 192.168.0.15: ICMP echo request, id 49222, seq 0, length 64
12:17:24.399906 IP 192.168.1.11 > 192.168.0.15: ICMP echo request, id 49222, seq 1, length 64

.. 192.168.1.11 ICMP echo request 192.168.0.15, . :

[root@freebsd ~]# tcpdump -ni em1

12:21:18.167017 IP 192.168.1.11 > 192.168.0.15: ICMP echo request, id 50246, seq 4, length 64
12:21:19.168022 IP 192.168.1.11 > 192.168.0.15: ICMP echo request, id 50246, seq 5, length 64

, , . 192.168.0.15 .

:

12:21:17.165998 IP 192.168.1.11 > 192.168.0.15: ICMP echo request, id 50246, seq 3, length 64
12:21:17.171199 IP 192.168.0.15 > 192.168.1.11: ICMP echo reply, id 50246, seq 3, length 64
12:21:18.167017 IP 192.168.1.11 > 192.168.0.15: ICMP echo request, id 50246, seq 4, length 64
12:21:18.171353 IP 192.168.0.15 > 192.168.1.11: ICMP echo reply, id 50246, seq 4, length 64

-, ICMP echo request ICMP echo reply

 (622x308, 44Kb)

: [1] []
 

:
: 

: ( )

:

  URL