.


:




:

































 

 

 

 


.




, , . . . ifconfig.

:

root# ifconfig eth0 192.168.0.1 netmask 255.255.255.0 up

eth0 IP- 192.168.0.1 255.255.255.0. up . , . ifconfig eth0 down.

. , , , , . , , . , , 192.168.0.0 192.168.0.255.

ifconfig , :

Up

( ).

Down

Arp

(arp) .

Allmulti

(multicast-). , . ',

Mtu N

MTU

netmask <addr>

,

irq <addr>

IRQ

[-]broadcast [addr]

.

[-]pointopoint [addr]

' - ( slip ppp)

hw <type> <addr>

. ethernet, , X.25

ifconfig - . , pppd dip .

.

ʳ , ' . . , - , . `127.0.0.1'. , telnet 127.0.0.1 - , ' . ( 䳿 ).

root# ifconfig lo 127.0.0.1 root# route add -host 127.0.0.1 lo

.

, . , , , , ' .

. , IP-?

IP- , , IP-.

. , PPP-' , ethernet- PPP-' . IP-, , . , , , , , ethernet-, PPP SLIP.

? , . - . , ' , , IP- , . Linux, :

user% cat /proc/net/route

:

user% /sbin/route -n user% netstat -r

: IP-, ( , ) . . - , , , , .

route. , , .

. , ethernet-. 192.168.1.0. 192.168.1.10 , , 192.168.1.1.

. :

root# ifconfig eth0 192.168.1.10 netmask 255.255.255.0 up

ϳ , 192.168.1.* eth0. :

root# route add -net 192.168.1.0 netmask 255.255.255.0 eth0

-net. , . -host IP-.

IP-' ethernet-. ?

IP- , . , . . :

root# route add default gw 192.168.1.1 eth0

gw route IP- ' , , .

:

root# ifconfig eth0 192.168.1.10 netmask 255.255.255.0 up root# route add -net 192.168.1.0 netmask 255.255.255.0 eth0 root# route add default gw 192.168.1.1 eth0

rc , , , , . .

. , . PPP-' ethernet-. :

root# route add -net 192.168.1.0 netmask 255.255.255.0 eth0 root# route add -net 192.168.2.0 netmask 255.255.255.0 eth1 root# route add -net 192.168.3.0 netmask 255.255.255.0 eth2 root# route add default ppp0

. ' . , . , gw. . ' , PPP SLIP (' -) ' . , ' , . , ethernet, arcnet token ring , .

ping - ICMP ECHO_REQUEST

/usr/sbin/ping [ ]
/usr/sbin/ping -s [-drvRlfnq] [-i ] [ -p ] [ _ [_] ]

ping ECHO_REQUEST ICMP, ICMP ECHO_RESPONSE . , ping , ( is alive), . , , (no answer from ). - - 20 .

-s, ping ECHO_RESPONSE. ping (round trip times) ; - . ' (_), ping . , . , , (Ctrl+C).

64 , _. , ping 8- , , -s _, 8 , .

ping , ping , , .

ping :

-d . SO_DEBUG.
-f ping. , , . ECHO_REQUEST ".", ECHO_REPLY (backspace). , . ҳ . .
-i _ _ . . -f.
-l . IP . -R. -l localhost `uname -n`.
-n ҳ . .
-p . , 16 . . , -p ff . , ' .
-q . , .
-r . , . ,
-R . IP, IP. , -v , , -l.
-s ECHO_RESPONSE ( , ).
-v . ICMP, ECHO_RESPONSE.

netstat -

netstat [-Aan] [-f _ ] [ -I ] [-p _] [] [core]
netstat [-n] [-s] [-i | -r ] [-f _ ] #@: #@; #@< #@=
netstat #@> #@? #@@ #@A

netstat , ' , .

(sockets) . .

; , .

- /unix; core /dev/kmem.

netstat :

-a ; , , .
-A - , ' ; .
-i (auto-configured) . , , , .
-n . netstat . - .
-r . -s, .
-s . -r, .
-f _ _, :
inet AF_INET,
unix AF_UNIX.
   

 

-I ; ( ) ' . - , , , emd1 lo0.
-p _ _, tcp.

( )

,
( ), , .

, , - :

_.

' , :

.

, . /etc/hosts /etc/networks.

' ( -n), . "" " *"..

TCP

TCP :

CLOSED . .
LISTEN '.
SYN_SENT '.
SYN_RECEIVED '.
ESTABLISHED ' .
CLOSE_WAIT ³ ; .
FIN_WAIT_1 ; '.
CLOSING , ; .
LAST_ACK ³ , ; .
FIN_WAIT_2 ; .
TIME_WAIT .
     

( )

, , , -i -r. , netstat -i.

(routes) . (gateway), . flags() (U, ), (G), (D) (H) . , (loopback transport provider ), lo0, H.

, ; gateway () .

refcnt . , ', ' , ' .

use , .

interface , .

( )

, netstat , 糿. ,
24- , , . , .

netstat, .





:


: 2017-02-11; !; : 449 |


:

:

, , .
==> ...

1997 - | 1658 -


© 2015-2024 lektsii.org - -

: 0.036 .