Você está na página 1de 10

TCP/IP Configuration Commands for UNIX/Linux, MacOS X, Windows, and Cisco I...

Page 1 of 10

TCP/IP Configuration Commands for UNIX/Linux, MacOS X, Windows, and Cisco IOS
The following commands will report the TCP/IP configuration on Unix, MacOS X, Windows, and Cisco operating systems. By "Unix" I mean anything vaguely Unix-like Solaris, Linux, BSD, Tru64, AIX, IRIX, HPUX, etc., plus MacOS X. Note that the Cisco IOS allows for command abbreviation. That is, instead of:
router> show interfaces

you could simply type:


router> sh in

However, I prefer to use the entire command, using the tab key for command completion. You type just sh and then press <tab>:
router> sh<tab>

and the system finishes the command itself:


router> show

AlphaServer DS10 and AlphaStation 200 4/233 running Linux and OpenBSD Unix.

At that point you could press ? to see what alternatives are available (in the case of the show command, quite a few!), and then type enough of the parameter to be unambiguous:
router> show in<tab>

and it finishes the parameter for you:


router> show interfaces

Just two more key presses gives you a clear explanation of what it's doing. More importantly, your typing errors become much more obvious!
Table of contents on this page LAN Information (OSI Layer 1 and 2) Display interface statistics Display media settings and options Display the ARP and NDP caches LAN troubleshooting IP Information (OSI Layer 3) Display IP interface configurations Display the routing table Configure IP settings Use traceroute UDP/TCP Information (OSI Layer 4) TCP/IP connection states, statistics and counters

LAN Information (OSI Layer 1 and 2)


Display the interface statistics (packets received and sent, errors, collisions, maybe the rate of packets or bytes per second, maybe the MAC addresses)
Ads by Google

Adressage TCP IP Linux IP Router

Cisco Catalyst 2900 XL switch.

Linux% netstat -i Kernel Interface table Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg eth0 1500 0 46249635 0 0 0 46076591 0 0 3 BMRU eth1 1500 0 780201 2 2 2 774526 0 0 8 BMRU

http://www.cromwell-intl.com/tcpip/commands.html

04/02/2012

TCP/IP Configuration Commands for UNIX/Linux, MacOS X, Windows, and Cisco I... Page 2 of 10

lo

16436

755482

755482

0 LRU

Unix and MacOS X

BSD and MacOS X, adding -n to leave addresses numeric. Following example from an OpenBSD laptop: lo0 = Loopback pseudo-device sis0 = Ethernet enc0 = Encapsulation pseudo-device BSD/MacOS% netstat -i -n Name Mtu Network lo0 33208 <Link> lo0 33208 127/8 lo0 33208 ::1/128 lo0 33208 fe80::%lo0/ sis0 1500 <Link> sis0 1500 fe80::%sis0 sis0 1500 10.1.1/24 enc0* 1536 <Link> C:\>netstat -e Interface Statistics

Address 127.0.0.1 ::1 fe80::1%lo0 00:11:43:44:8a:9b fe80::211:43ff:fe 10.1.1.230

netstat -i

Ipkts Ierrs 12 0 12 0 12 0 12 0 1522 0 1522 0 1522 0 0 0

Opkts Oerrs Colls 12 0 0 12 0 0 12 0 0 12 0 0 899 0 0 899 0 0 899 0 0 0 0 0

Windows
netstat -e

Bytes Unicast packets Non-unicast packets Discards Errors Unknown protocols

Received 1160647 858 70 0 0 0

Sent 105766 200 45 0 0

Cisco
show interfaces

router> show interfaces ethernet 0 Ethernet0 is up, line protocol is up Hardware is Lance, address is 0000.0c8e.b534 (bia 0000.0c8e.b534) Internet address is 10.1.1.254/24 MTU 1500 bytes, BW 10000 Kbit, DLY 1000 usec, rely 255/255, load 2/255 Encapsulation ARPA, loopback not set, keepalive set (10 sec) ARP type: ARPA, ARP Timeout 04:00:00 Last input 00:00:00, output 00:00:00, output hang never Last clearing of "show interface" counters never Queueing strategy: fifo Output queue 0/40, 0 drops; input queue 1/75, 0 drops 5 minute input rate 108000 bits/sec, 18 packets/sec 5 minute output rate 107000 bits/sec, 18 packets/sec 6080 packets input, 4156592 bytes, 0 no buffer Received 869 broadcasts, 0 runts, 0 giants, 0 throttles 0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort 0 input packets with dribble condition detected 5858 packets output, 4036087 bytes, 0 underruns 0 output errors, 0 collisions, 10 interface resets 0 babbles, 0 late collision, 0 deferred 0 lost carrier, 0 no carrier 0 output buffer failures, 0 output buffers swapped out

Display the interface media settings and options (RJ-45 vs AUI interface, media speed and duplex settings, MTU, etc)
Linux# ethtool eth0 Settings for eth0: Supported ports: [ TP MII ] Supported link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full Supports auto-negotiation: Yes Advertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full Advertised auto-negotiation: Yes Speed: 100Mb/s Duplex: Full Port: MII PHYAD: 32 Transceiver: internal Auto-negotiation: on Supports Wake-on: pumbg Wake-on: d Current message level: 0x00000007 (7) Link detected: yes BSD/MacOS% ifconfig sis0 media sis0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500 lladdr 00:11:43:44:8a:9b groups: egress media: Ethernet autoselect (100baseTX full-duplex) status: active supported media: media 10baseT media 10baseT mediaopt full-duplex media 100baseTX

Linux
ethtool interface

BSD and MacOS X


ifconfig -m

or, depending on version

http://www.cromwell-intl.com/tcpip/commands.html

04/02/2012

TCP/IP Configuration Commands for UNIX/Linux, MacOS X, Windows, and Cisco I... Page 3 of 10

ifconfig interface media

media 100baseTX mediaopt full-duplex media autoselect inet6 fe80::211:43ff:fe44:8a9b%sis0 prefixlen 64 scopeid 0x1 inet 10.1.1.230 netmask 0xffffff00 broadcast 10.1.1.255

Cisco See the example in the above section.


show interfaces

Display the ARP and NDP cache


ARP maps between IPv4 and MAC or hardware address.
Linux / BSD: % arp -a

Unix and MacOS X somehost.example.com (192.168.12.230) at 00:11:43:44:8A:9B [ether] on eth0


arp -a

otherhost.example.com (192.168.12.230) at 00:11:43:37:C2:21 [ether] on eth0 router.example.com (192.168.12.1) at 00:01:5C:24:85:02 [ether] on eth0 router-s1.isp.net (98.223.96.1) at 00:01:5c:24:9c:01 [ether] on eth1 Solaris: % arp -a Net to Media Table: IPv4 Device IP Address ------ -------------------bge0 224.101.101.101 bge0 otherhost1 bge0 otherhost2 bge0 myself bge0 otherhost3 bge0 otherhost4 bge0 base-address.mcast.net Cisco:

Windows
arp -a

Mask --------------255.255.255.255 255.255.255.255 255.255.255.255 255.255.255.255 255.255.255.255 255.255.255.255 240.0.0.0

Flags Phys Addr -------- --------------01:00:5e:65:65:65 o 00:03:ba:55:94:91 o 00:14:4f:48:85:30 SPLA 00:14:4f:62:87:1a o 00:14:38:8e:c6:d0 o 00:01:e6:98:c8:ee SM 01:00:5e:00:00:00

Cisco
show arp

router#show arp Protocol Address Internet 10.1.1.100 Internet 192.168.1.254 Internet 10.1.1.230 Internet 10.1.1.254

Age (min) 0 0 -

Hardware Addr 6c62.6db2.f841 0000.0c8e.b535 2c27.d7c5.d37b 0000.0c8e.b534

Type ARPA ARPA ARPA ARPA

Interface Ethernet0 Ethernet1 Ethernet0 Ethernet0

NDP maps between IPv6 and MAC or hardware address. It is based on a subset of the ICMPv6 protocol. Linux
ip -6 neigh show % ndp -a Neighbor fe80::211:43ff:fe44:8a9b%sis0 fe80::6e62:6dff:feb2:f841%sis0 fe80::1%lo0

% ip -6 neigh show fe80::211:43ff:fe44:8a9b dev eth0 lladdr 00:11:43:44:8a:9b REACHABLE

BSD
ndp -a

Linklayer Address 0:11:43:44:8a:9b 6c:62:6d:b2:f8:41 (incomplete)

Netif sis0 sis0 lo0

Expire permanent 23h58m40s permanent

S Flags R S R R

In the above output, sis0 is the Ethernet interface. The first entry listed is for this host's Ethernet interface, the last is for this host's software lookback address.

Windows
netsh interface ipv6 show neighbors
Cisco WS-C3550-24SMI Catalyst 3550 ... CISCO SYSTEMS EN... New $550.00 Best $125.99 Cisco WS-C356024TS-E Catalyst 3560-... CISCO SYSTEMS EN... New $2,137.86 Best $788.88 Cisco WS-C2950-24 Catalyst 2950-24 1... CISCO SYSTEMS EN... New $422.00 Best $25.00

LAN Troubleshooting and Configuration


There should be no collisions on a switched LAN. If you do see collisions, suspect problems with the negotiation of speed and duplex mode. Some kernel modules (device drivers) may auto-negotiate by default, but then have an option to force auto-negotiation that causes slightly different behavior and results. Experiment! To set the speed and duplex mode, you could run the appropriate ethtool or ifconfig media command immediately after booting, perhaps through /etc/rc.local. The problem is that the interface would have already come up in an inappropriate mode and

http://www.cromwell-intl.com/tcpip/commands.html

04/02/2012

TCP/IP Configuration Commands for UNIX/Linux, MacOS X, Windows, and Cisco I... Page 4 of 10

networking would have to be restarted, especially if you are using DHCP. A better solution would be to load the kernel module with the appropriate optional parameter. On Linux, see the kernel documentation for the driver-specific options. The details should be in /usr/src/linux/Documentation/networking/drivername*, although at times you have to look at the source code itself, /usr/src/linux/drivers/net/driver-name*. Once you find the appropriate parameters, specify them as option lines in /etc/modprobe.conf. On BSD, add the appropriate fields to the /etc/hostname.interface file, the options will be applied when the kernel first brings up the interface. For example:
$ cat /etc/hostname.sis0

Rack of Ethernet switches.


10.1.1.230 netmask 255.255.255.0 media 100baseT mediaopt full-duplex

If there are significant numbers of errors other than collisions, suspect problems with the Ethernet cables (most likely) or possibly the system's Ethernet card or the switch port.
Cisco Official Website Smarter & cost-effective way to do business with Cisco's solutions www.cisco.com/uk Network Configuration Check Out Our Services! Reliable IT Networking Service. advantagetechnologiesthetford.co.uk Map route Search Maps, Get Driving Directions Instantly From Your Browser Free! www.MapsGalaxy.com

IP Information (OSI Layer 3)


Display the current IP configuration (IP address, netmask) for the interfaces
An example from a Linux system with two Ethernet interfaces, eth0 and eth1, the second of which has two virtual interface configurations and which has been assigned a specific IPv6 address:
% ifconfig -a eth0 Link encap:Ethernet HWaddr 00:11:95:1E:8E:B6 inet addr:98.228.31.224 Bcast:255.255.255.255 Mask:255.255.248.0 inet6 addr: fe80::211:95ff:fe1e:8eb6/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:46932082 errors:0 dropped:0 overruns:0 frame:0 TX packets:46814984 errors:0 dropped:0 overruns:8 carrier:0 collisions:0 txqueuelen:1000 RX bytes:809855308 (772.3 MiB) TX bytes:2776351401 (2.5 GiB) Interrupt:21 Base address:0xa000 eth1 Link encap:Ethernet HWaddr 00:0D:61:B1:86:53 inet addr:10.1.1.100 Bcast:10.1.1.255 Mask:255.255.255.0 inet6 addr: 2001:1800:1234:90::1/64 Scope:Global inet6 addr: fe80::20d:61ff:feb1:8653/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:789491 errors:3 dropped:3 overruns:3 frame:0 TX packets:785514 errors:0 dropped:0 overruns:15 carrier:0 collisions:0 txqueuelen:1000 RX bytes:234930278 (224.0 MiB) TX bytes:342684110 (326.8 MiB) Interrupt:19 Base address:0x8000 Link encap:Ethernet HWaddr 00:0D:61:B1:86:53 inet addr:10.0.0.100 Bcast:10.0.0.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 Interrupt:19 Base address:0x8000 Link encap:Ethernet HWaddr 00:0D:61:B1:86:53 inet addr:10.1.0.254 Bcast:10.1.255.255 Mask:255.255.0.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 Interrupt:19 Base address:0x8000 Link encap:Local Loopback

eth1:0

eth1:1

lo

http://www.cromwell-intl.com/tcpip/commands.html

04/02/2012

TCP/IP Configuration Commands for UNIX/Linux, MacOS X, Windows, and Cisco I... Page 5 of 10

inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:760670 errors:0 dropped:0 overruns:0 frame:0 TX packets:760670 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:676142037 (644.8 MiB) TX bytes:676142037 (644.8 MiB) sit0 Link encap:IPv6-in-IPv4 NOARP MTU:1480 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

An example from a BSD system with one Ethernet interface, re0, which has auto-configured an IPv6 address on the 2001:1800:1234:90::/64 network: Unix and MacOS X
ifconfig -a
% ifconfig lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 33200 priority: 0 groups: lo inet 127.0.0.1 netmask 0xff000000 inet6 ::1 prefixlen 128 inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3 re0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500 lladdr 2c:27:d7:c5:d3:7b priority: 0 groups: egress media: Ethernet autoselect (100baseTX full-duplex) status: active inet6 fe80::2e27:d7ff:fec5:d37b%re0 prefixlen 64 scopeid 0x1 inet 10.1.1.230 netmask 0xffffff00 broadcast 10.1.1.255 inet6 2001:1800:1234:90:2e27:d7ff:fec5:d37b prefixlen 64 enc0: flags=0<> priority: 0 groups: enc status: active pflog0: flags=141<UP,RUNNING,PROMISC> mtu 33200 priority: 0 groups: pflog C:\>ipconfig /all Windows IP Configuration Host Name . . . . . . . Primary Dns Suffix . . Node Type . . . . . . . IP Routing Enabled. . . WINS Proxy Enabled. . . DNS Suffix Search List. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . : : : : : : WINXP Unknown No No example.com

Windows
ipconfig /all

Ethernet adapter Local Area Connection: Connection-specific Description . . . . Physical Address. . Dhcp Enabled. . . . IP Address. . . . . Subnet Mask . . . . Default Gateway . . DNS Servers . . . . DNS . . . . . . . . . . . . . . Suffix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . : : : : : : : :

VMware Accelerated AMD PCNet Adapter 00-0C-29-A4-AE-C9 No 10.1.1.222 255.255.255.0 10.1.1.100 10.1.1.100

Cisco
show or show or show or show ip config running-config protocols interfaces

router> show protocols Global values: Internet Protocol routing is enabled Ethernet0 is up, line protocol is up Internet address is 10.1.1.254/24 Ethernet1 is up, line protocol is up Internet address is 192.168.1.254/24 Serial0 is administratively down, line protocol is down Serial1 is administratively down, line protocol is down
Networking All-in-One For Dummies Doug Lowe New $24.34 Best $22.94 The TCP/IP Guide Charles M. Koziero... New $58.36 Best $45.99 Computer Networks Andrew S. Tanenbau... New $72.42 Best $10.00

Display the current routing table


Output from the same Linux machine with following IP addresses: eth0 98.228.31.224/21

http://www.cromwell-intl.com/tcpip/commands.html

04/02/2012

TCP/IP Configuration Commands for UNIX/Linux, MacOS X, Windows, and Cisco I... Page 6 of 10

eth1 eth1:0 eth1:1

2001:1800:1234:90::1/64 Scope:Global fe80::6e62:6dff:feb2:f841/64 Scope:Link 10.1.1.100/24 10.1.0.100/24 10.1.0.254/24

Linux% netstat -nr Kernel IP routing table Destination Gateway 10.0.0.0 0.0.0.0 10.1.1.0 0.0.0.0 98.228.24.0 0.0.0.0 10.1.0.0 0.0.0.0 169.254.0.0 0.0.0.0 169.254.0.0 0.0.0.0 0.0.0.0 98.228.24.1 Linux% netstat -nr -A inet6 Kernel IPv6 routing table Destination fe80::/64 2001:1800:1234:90::/64 fe80::/64 ::1/128 2001:1800:1234:90::/128 2001:1800:1234:90::1/128 fe80::/128 fe80::/128 fe80::211:95ff:fe1e:8eb6/128 fe80::6e62:6dff:feb2:f841/128 ff00::/8 ff00::/8

Genmask 255.255.255.0 255.255.255.0 255.255.248.0 255.255.0.0 255.255.0.0 255.255.0.0 0.0.0.0

Flags U U U U U U UG

MSS 0 0 0 0 0 0 0

Window 0 0 0 0 0 0 0

irtt 0 0 0 0 0 0 0

Iface eth1 eth1 eth0 eth1 eth1 eth0 eth0

Next Hop :: :: :: :: :: :: :: :: :: :: :: ::

Flags U U U U U U U U U U U U

Metric 256 256 256 0 0 0 0 0 0 0 256 256

Ref 0 0 0 76 0 0 0 0 0 0 0 0

Use 0 0 0 1 1 1 1 1 1 1 0 0

Iface eth0 eth1 eth1 lo lo lo lo lo lo lo eth0 eth1

Flags: U = Up G = Gateway The IPv6 routing table prints much wider, as there is enough room in the "Destination" and "Next Hop" columns for a full IPv6 address. One line is listed for IPv6 neighbor on the network, the neighbors IPv6 address/128 as the destination, its IPv6 address as the next hop. Add -f inet to see IPv4 only on BSD and MacOS X, otherwise you see voluminous IPv6 routing information:

Unix and MacOS X


netstat -nr

BSD/MacOS% netstat -nr Routing tables Internet: Destination default 10.1.1/24 10.1.1.100 10.1.1.230 127/8 127.0.0.1 224/4

Gateway 10.1.1.100 link#1 6c:62:6d:b2:f8:41 127.0.0.1 127.0.0.1 127.0.0.1 127.0.0.1

Flags UGS UC UHLc UGHS UGRS UH URS

Refs 3 1 2 0 0 4 0

Use 338 0 2064 0 0 4602 0

Mtu 33200 33200 33200 33200

Prio 8 4 4 8 8 4 8

Iface re0 re0 re0 lo0 lo0 lo0 lo0

Internet6: Destination ::/104 ::/96 ::1 ::127.0.0.0/104 ::224.0.0.0/100 ::255.0.0.0/104 ::ffff:0.0.0.0/96 2001:1800:1234:90::/64 2001:1800:1234:90::1 2001:1800:1234:90:2e27:d7ff:fec5:d37b 2002::/24 2002:7f00::/24 2002:e000::/20 2002:ff00::/24 fe80::/10 fe80::%re0/64 fe80::2e27:d7ff:fec5:d37b%re0 fe80::%lo0/64 fe80::1%lo0 fec0::/10 ff01::/16 ff01::%re0/32 ff01::%lo0/32 ff02::/16 ff02::%re0/32 ff02::%lo0/32 Flags: U = Up G = Gateway S = Static, e.g., default route added at boot time

Gateway ::1 ::1 ::1 ::1 ::1 ::1 ::1 link#1 6c:62:6d:b2:f8:41 2c:27:d7:c5:d3:7b ::1 ::1 ::1 ::1 ::1 link#1 2c:27:d7:c5:d3:7b fe80::1%lo0 link#3 ::1 ::1 link#1 ::1 ::1 link#1 ::1

Flags UGRS UGRS UH UGRS UGRS UGRS UGRS UC UHLc UHL UGRS UGRS UGRS UGRS UGRS UC UHL U UHL UGRS UGRS UC UC UGRS UC UC

Refs 0 0 14 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Use Mtu 0 0 0 33200 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -

Prio 8 8 4 8 8 8 8 4 4 4 8 8 8 8 8 4 4 4 4 8 8 4 4 8 4 4

Iface lo0 lo0 lo0 lo0 lo0 lo0 lo0 re0 re0 lo0 lo0 lo0 lo0 lo0 lo0 re0 lo0 lo0 lo0 lo0 lo0 re0 lo0 lo0 re0 lo0

http://www.cromwell-intl.com/tcpip/commands.html

04/02/2012

TCP/IP Configuration Commands for UNIX/Linux, MacOS X, Windows, and Cisco I... Page 7 of 10

H = Host-specific C = Generate new (host-specific) routes on use L = Valid link-layer (MAC) address c = Cloned route R = Reject route, known but unreachable route C:\>netstat -nr =========================================================================== Interface List 0x1 ........................... MS TCP Loopback interface 0x10003 ...00 0c 29 a4 ae c9 ...... AMD PCNET Family PCI Ethernet Adapter =========================================================================== =========================================================================== Active Routes: Network Destination Netmask Gateway Interface Metric 0.0.0.0 0.0.0.0 10.1.1.100 10.1.1.222 10.1.1.0 255.255.255.0 10.1.1.222 10.1.1.222 10.1.1.222 255.255.255.255 127.0.0.1 127.0.0.1 10.255.255.255 255.255.255.255 10.1.1.222 10.1.1.222 127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1 224.0.0.0 240.0.0.0 10.1.1.222 10.1.1.222 255.255.255.255 255.255.255.255 10.1.1.222 10.1.1.222 Default Gateway: 10.1.1.100 =========================================================================== Persistent Routes: None Route Table router> show ip route Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default U - per-user static route, o - ODR Gateway of last resort is 10.1.1.100 to network 0.0.0.0 10.0.0.0/24 is subnetted, 1 subnets 10.1.1.0 is directly connected, Ethernet0 192.168.1.0/24 is directly connected, Ethernet1 0.0.0.0/0 [1/0] via 10.1.1.100

Windows
netstat -nr

10 10 10 10 1 10 1

Cisco
show ip route

C C S*

See the page "How Routing Works" for an explanation of IP routing and example output.
Network Fundamentals, CCNA Explorati... Antoon Rufi, Prisc... New $34.49 Best $13.55 Adobe Creative Suite 5 Design Premiu... Jennifer Smith, Ch... New $23.81 Best $21.91 Routing Protocols and Concepts, CCNA... Allan Johnson New $34.97 Best $11.05

Interactive Changes to the IP Configuration


On Linux and BSD, you can assign an IP address and netmask interactively. You will need to know the correct device name on BSD, but ifconfig -a will show you the list. Then just do something like this:
# ifconfig eth0 192.168.250.219/24

To add an IPv6 address on Linux and BSD:


Linux: # ifconfig eth0 add 2001:1800:1234:90::1/64 BSD: # ifconfig re0 inet6 2001:1800:1234:90::1/64

Then add the default route with something like this:


BSD: # route add default 192.168.250.254 Linux: # route add default gw 192.168.250.254

Permanent Changes to the IP Configuration


On BSD, configure the interface in /etc/hostname.name and the default gateway in /etc/mygate:
% cat /etc/hostname.re0 inet 192.168.250.219 255.255.255.0 NONE inet6 2001:1800:1234:90:2e27:d7ff:fec5:d37b 64 % cat /etc/mygate 192.168.250.1

On most Linux distributions, configure the interface in /etc/sysconfig/network-scripts/ifcfg-name and the default gateway

http://www.cromwell-intl.com/tcpip/commands.html

04/02/2012

TCP/IP Configuration Commands for UNIX/Linux, MacOS X, Windows, and Cisco I... Page 8 of 10

in /etc/sysconfig/network:
% cat /etc/sysconfig/network-scripts/ifcfg-eth1 DEVICE=eth1 BOOTPROTO=static IPADDR=192.168.250.219 ## Always include the NETMASK field. Red Hat Enterprise Linux 6 ## leaves this out. It includes a PREFIX field, which does get ## the netmask correctly set, but their boot scripts then ## miscalculate the broadcast address! NETMASK=255.255.255.0 ## Always comment out the unneeded BROADCAST and NETWORK entries ## added by Red Hat's installation tools! If you leave them in, ## and later you make manual changes that are the least bit ## contradictory, strange problems will occur! # BROADCAST=192.168.250.255 # NETWORK=192.168.250.0 ## Also comment out the unneeded HWADDR entry added by Red Hat's ## installation tool! If you leave it in, and then change your ## Ethernet card, your networking will mysteriously fail. # HWADDR=00:03:47:76:23:F8 ## If you want IPv6: IPV6INIT=yes IPV6ADDR=2001:1800:1234:90::1/64 % cat /etc/sysconfig/network HOSTNAME=whatever.example.com NETWORKING=yes NETWORKING_IPV6=yes IPV6FORWARDING=yes

On Debian/Ubuntu Linux, configure the interface in and default gateway in /etc/network/interfaces:


% cat interfaces auto lo iface lo inet loopback iface eth0 inet static address 192.168.250.219 netmask 255.255.255.0 gateway 192.168.250.1 auto eth0
Cisco CISCO1841 1841 Integrated Ser... CISCO SYSTEMS EN... New $773.00 Best $225.00 Cisco CISCO1841SEC/K9 1841 Router ... CISCO SYSTEMS EN... New $994.00 Best $365.00 Cisco CISCO861-K9 861 Ethernet Secur... CISCO SYSTEMS EN... New $269.03 Best $269.03

Use traceroute to trace the hop-by-hop route to a destination


Unix and MacOS X traceroute 195.242.3.1 Windows Cisco
tracert 195.242.3.1 trace

You will then be asked to enter the target IP address.

The output will resemble something like the following, with one line per router along the way, and three probes to each router. Note that many web servers today silently drop traceroute probes, so you will see the trace to the last router and dropped packets (stars) beyond that. Also remember that most organizations pay a company to host their web server at an entirely different point in the Internet topology than their main operation. For example, www.pentagon.mil is hosted by Akamai, which means that many mirrors of it are distributed around the Internet, none of them at the five-sided building in Washington DC. Here's a trace from Indiana to Moscow:
$ traceroute www.fsb.ru traceroute to www.fsb.ru (213.24.76.23), 30 hops max, 40 byte packets 1 itns-core-vss-01-vlan444.ecn.purdue.edu (128.46.144.1) 0.450 ms 0.436 ms 0.473 ms 2 tel-210-c7609s-01-po1.tcom.purdue.edu (172.28.252.14) 0.349 ms 0.354 ms 0.353 ms 3 indiana-gigapop-ctc-internet-mx960.tcom.purdue.edu (192.5.40.179) 1.375 ms 1.396 ms 1.419 ms 4 xe-0-2-0.111.rtr.ll.indiana.gigapop.net (149.165.254.22) 1.506 ms 1.459 ms 1.464 ms 5 xe-0-2-0.111.rtr.atla.net.internet2.edu (149.165.254.23) 16.586 ms 16.578 ms 16.583 ms 6 xe-1-0-0.0.rtr.wash.net.internet2.edu (64.57.28.59) 30.242 ms 30.243 ms 30.212 ms 7 xe-2-0-0.0.rtr.newy32aoa.net.internet2.edu (64.57.28.74) 35.432 ms 35.428 ms 35.376 ms 8 ge5-3-0-1000M.ar1.SJC2.gblx.net (64.208.110.25) 35.596 ms 35.602 ms 35.593 ms 9 PO1-20G.ar1.ARN3.gblx.net (67.17.109.213) 141.805 ms 142.065 ms 142.187 ms 10 RT-COMM-RU-OJSC.Port-channel2.463.ar1.ARN3.gblx.net (64.213.54.50) 144.452 ms 144.487 ms 144.472 ms 11 195.161.47.126 (195.161.47.126) 157.495 ms 155.553 ms * 12 213.59.2.62 (213.59.2.62) 155.583 ms 155.199 ms 157.258 ms 13 * * *

http://www.cromwell-intl.com/tcpip/commands.html

04/02/2012

TCP/IP Configuration Commands for UNIX/Linux, MacOS X, Windows, and Cisco I... Page 9 of 10

14 15 16

* * * * * * * * *

Hops 1-3: Across Purdue University's networks and to an Internet2 gateway in Indianapolis. Fractions of milliseconds to get across campus, just over 1 millisecond to get to Indianapolis, maybe 150 km away along the fiber route. Hops 3-7: Across the internet2.edu very high speed backbone. Interpreting the router names: Indianapolis IN; Atlanta GA; Washington DC; New York NY. Notice the IN-GA and GA-DC hops add about 15 milliseconds each, and DC-NY adds about another 5 msec. Hops 8-10: Across the Global Crossing gblx.net world-wide backbone. Notice how much time gets added from hops 8 to 9, compared to the time for hops 1-10. Hop #11 crosses the Atlantic by fiber, and the speed of light is a hard speed limit. Hops 11-12: Two hops within Russia, probably within Moscow. Hops 13 and beyond: One possibility is that a firewall is hop 13 and it is silently dropping the arriving traceroute probes, and the server would then be hop 14. Another possibility is that the server itself is hop 13 and it is silently dropping the packets.

UDP/TCP Information (OSI Layer 4)


Display all TCP connections, listening ports and service states
Click here to see several detailed examples of netstat -a output and the corresponding Cisco output. Rack of Cisco routers. Most are 3600 series routers, the brown one near the bottom is a 2500 series. The network connections on on the opposite side, the single cable to each router is a connection to its console port.

netstat -a

Note check the manual page for your version of netstat to find the option to only show TCP/IP and Unix and MacOS X leave out the possibly voluminous UNIX domain socket information. It's probably -f inet or -A inet, and -f inet6 or -A inet6 if you're running IPv6. Windows Cisco
netstat -a show tcp brief show tcp

General Information
Display TCP/IP statistics (or counters)
Click here to see several detailed examples of netstat -s output and the corresponding Cisco output. Unix and MacOS X netstat -s Windows Cisco
netstat -s show interfaces show ip traffic show tcp statistics
Ads by Google

Linux IP Router DNS IP

Other Pages
How to break in, initialize, and configure a Cisco router How to program Cisco Catalyst and 3com 3000 switches Cisco Catalyst 2900 XL Ethernet switch disassembly and repair

http://www.cromwell-intl.com/tcpip/commands.html

04/02/2012

TCP/IP Configuration Commands for UNIX/Linux, MacOS X, Windows, and Cisc...

Page 10 of 10

Network and Telecommunication Cables Back to the main TCP/IP networking page.
Cables To Go 33343 LC/SC Duplex 9/12... CABLES TO GO New $26.22 Cables To Go 37492 SC/SC Duplex 9/12... CABLES TO GO New $46.75 Cables to Go 13551 SC/SC Duplex 62.5... CABLES TO GO New $21.89

Cables to Go 14462 SC/SC Duplex 9/12... CABLES TO GO New $36.82

Cables To Go 37917 LC/LC Plenum-Rate... CABLES TO GO New $42.89

Cables To Go 34661 ST/ST LSZH Duplex... CABLES TO GO New $49.90

Cables To Go 38608 LC/LC Plenum-Rate... CABLES TO GO New $62.85

Cables To Go 33375 LC/LC Duplex 9/12... CABLES TO GO New $28.39

Cables To Go 33342 LC/SC Duplex 9/12... CABLES TO GO New $24.87

Privacy Information

Ads by Google

Home
41 erahS
0

Unix or Linux Unix Tutorial Unix/Linux Networking Cybersecurity Travel

Wireless IP Technical Radio

Cisco Configuration Site Map Contact

Bob Cromwell Feb 2012. Created with /bin/vi and ImageMagick, hosted on OpenBSD with Apache.

Root password available here, privacy policy here.

http://www.cromwell-intl.com/tcpip/commands.html

04/02/2012

Você também pode gostar