|
L in u X ba sics for h acke rs g e t t I n g s t a r t e d w I t hBog'liq linuxbasicsforhackersAnalyzing Networks with ifconfig
The
ifconfig
command is one of the most basic tools for examining and
interacting with active network interfaces. You can use it to query your
active network connections by simply entering
ifconfig
in the terminal.
Try it yourself, and you should see output similar to Listing 3-1.
30
Chapter 3
kali >
ifconfig
u
eth0: flags=4163 mtu 1500
v
inet addr:192.168.181.131 netmask 255.255.255.0
Bcast:192.168.181.255
--
snip
--
lo Linkencap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
--
snip
--
wlan0 Link encap:EthernetHWaddr 00:c0:ca:3f:ee:02
Listing 3-1: Using
ifconfig
to get network information
As you can see, the command
ifconfig
shows some useful informa-
tion about the active network interfaces on the system. At the top of the
output is the name of the first detected interface,
eth0
u
, which is short for
Ethernet0 (Linux starts counting at 0 rather than 1). This is the first wired
network connection. If there were more wired Ethernet interfaces, they
would show up in the output using the same format (
eth1
,
eth2
, and so on).
The type of network being used (
Ethernet
) is listed next, followed by
HWaddr
and an address; this is the globally unique address stamped on every
piece of network hardware—in this case, the network interface card (NIC),
usually referred to as the media access control (MAC) address.
The second line contains information on the IP address currently
assigned to that network interface (in this case, 192.168.181.131
v
); the
Bcast
, or broadcast address, which is the address used to send out informa-
tion to all IPs on the subnet; and finally the network mask (
netmask
), which is
used to determine what part of the IP address is connected to the local net-
work. You’ll also find more technical info in this section of the output, but
it’s beyond the scope of this Linux networking basics chapter.
The next section of the output shows another network connection
called
lo
, which is short for loopback address and is sometimes called
localhost. This is a special software address that connects you to your own
system. Software and services not running on your system can’t use it. You
would use
lo
to test something on your system, such as your own web server.
The localhost is generally represented with the IP address 127.0.0.1.
The third connection is the interface
wlan0
. This appears only if you
have a wireless interface or adapter, as I do here. Note that it also displays
the MAC address of that device (
HWaddr
).
This information from
ifconfig
enables you to connect to and manipu-
late your local area network (LAN) settings, an essential skill for hacking.
|
| |