Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Linux+ Certification Bible.pdf
Скачиваний:
46
Добавлен:
15.03.2015
Размер:
3.78 Mб
Скачать

Chapter 12 Linux Disk and System Management

393

up: Refocus gdb up one function in the call stack

down: Refocus gdb down one function in the call stack

help: Get help for a command

run: Start execution of a program

b: Set a breakpoint at a line or function

clear: Clear a breakpoint from a line or function

commands: Set commands to be executed when a breakpoint is hit

s: Execute one more line (possibly in a subroutine)

n: Execute to next line of current function

continue: Continue execution to next breakpoint

watch: Watch for a change in an expression (this can be slow)

list: List source lines of a function

You don’t need to know the gdb tool in detail, but you do need to know its function, and when to delete a core dump or forward it to a programmer.

Managing Networking Interfaces

5.4 Run and interpret ifconfig

Networking is one of the most basic and critical services run from the Linux system. The task of configuring, administering, and monitoring your network interfaces is not needed every single day, but is extremely important to know when troubleshooting network problems.

The central command for network interface management is the ifconfig command. Use this command to view information on all your network cards. You can also use this command to configure the network cards with a network address, subnet mask, gateway, and other network settings.

If you type the ifconfig from the command line, you will get the configuration of the first network interface in your machine. If you have multiple network cards, you should use the ifconfig, which is a command to list all network interfaces. You can also choose each interface by name. The first ethernet interface is called etho; the next, eth1, and so on.

The following is a sample output of the ifconfig command:

> ifconfig eth0

eth0 Link encap: Ethernet HWaddr 00:60:67:4A:02:0A

inet addr:0.0.0.0 Bcast:0.0.0.0 Mask:255.255.255.255

394 Part V Maintaining the Linux System

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:466 errors:0 dropped:0 overruns:0 frame:0

TX packets:448 errors:0 dropped:0 overruns:0 carrier:0 collisions:85 txqueuelen:100

Interrupt:10 Base address:0xe400

This command shows a large amount of information on the card, including its type, its hardware MAC address, the IP address and subnet mask, and communications statistics, such as the number of network packets received and transmitted. This command also shows you how many network packets have been dropped. A high number of dropped packets indicate that you may be experiencing network problems, such as high traffic and network overload.

You should also have a local loopback address called interface “lo.” This loopback interface is a special virtual interface that allows you to make network connections to your own system. This interface also allows you to test locally without sending any packets onto a network. The local loopback address is always assigned an IP address of 127.0.0.1.

To see the loopback interface, use the following command:

ifconfig lo

The output should look similar to the following:

lo

Link

encap

Local Loopback

 

 

 

inet

addr 127.0.0.1

Bcast [NONE SET]

Mask 255.0.0.0

 

UP BROADCAST

LOOPBACK RUNNING

MTU 2000

Metric 1

 

RX

packets

0

errors 0

dropped 0

overrun 0

 

TX

packets

0

errors 0

dropped 0

overrun 0

You can use the ifconfig to configure an interface. The following is the syntax of the ifconfig:

ifconfig interface options | address

To configure a network interface with a new IP address, use ifconfig, as in the following example, to enter all the information that you need to get the network connection live.

ifconfig eth0 192.168.1.1 netmask 255.255.255.0 broadcast 192.168.1.255

This command sets the first ethernet interface with the IP address of 192.168.1.1, a class C subnet mask of 255.255.255.0, and a broadcast address of 192.168.1.255.

You can also use the ifconfig to enable and disable an interface. For example, to disable the first ethernet interface, use the following command:

ifconfig eth0 down

Соседние файлы в предмете Операционные системы