Академический Документы
Профессиональный Документы
Культура Документы
Code:
ifconfig; route -n; cat /etc/resolv.conf; ping
google.com -c 4; traceroute google.com; curl
ifconfig.me; echo $http_proxy
1.
For basic networking commands,
please see this
post:https://forums.kali.org/showthre
ad.p...ll=1#post32652
Stage 1. - IP address
To check our current IP
address, we can
use ifconfig. (or 'ip a' / 'ip link')
Note: you may want to use the '-a' flag
(ifconfig -a) to show all NICs (including the
ones that are down). For more information,
seehere.
Code:
root@kali ~$ ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:0b:29:9b:c9:a3
inet addr:192.168.1.48 Bcast:192.168.1.255
Mask:255.255.255.0
inet6 addr: fe81::21c:29aa:fe9c:b9a3/64
Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500
Metric:1
RX packets:293492 errors:0 dropped:0
overruns:0 frame:0
TX packets:135760 errors:0 dropped:0
overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:431811848 (411.8 MiB) TX
bytes:7409937 (7.0 MiB)
Interrupt:19 Base address:0x2000
root@kali ~$
DHCP vs Static IP
DHCP
If there is a DHCP service running on the network, you will
automatically be assigned a free available IP address from
its IP pool. Depending on its configuration, you may also be
assigned a gateway and/or DNS addresses too.
Static
If you wish to manually control your IP address, we are
able to use 'ifconfig' again to alter our IP address (and
subnet).
Code:
root@kali ~$ ifconfig eth0 192.168.0.10
root@kali ~$ ifconfig eth0 192.168.1.25/24
root@kali ~$ ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:0c:29:9c:b9:a3
inet addr:192.168.1.25 Bcast:192.168.1.255
Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe9c:b9a3/64
Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500
Metric:1
RX packets:294583 errors:0 dropped:0
overruns:0 frame:0
TX packets:135793 errors:0 dropped:0
overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:431879127 (411.8 MiB) TX
bytes:7413464 (7.0 MiB)
Interrupt:19 Base address:0x2000
root@kali ~$
Search: https://www.kali.org/search/
Documentation: http://docs.kali.org/ (Offline PDF version)
Bugs Reporting & Tool Requests: https://bugs.kali.org/
Kali Tool List, Versions & Man Pages: http://tools.kali.org/
2.
1. Stage 2. - Gateway
A network gateway is
responsible for connecting
two different networks
together.
If you're having issues
accessing resources outside
of your LAN subnet (e.g.
WAN (the Internet), but LAN
(local resources) is working),
there is a good chance there
is an issue with the gateway.
Depending on if a DHCP
service is used, as well as
how it has been configured,
it may push out a gateway
address.
Code:
root@kali ~$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags
Metric Ref Use Iface
0.0.0.0 192.168.1.2 0.0.0.0 UG 0
0 0 eth0
192.168.1.0 0.0.0.0 255.255.255.0 U 0
0 0 eth0
root@kali ~$
Search: https://www.kali.org/search/
Documentation: http://docs.kali.org/ (Offline PDF version)
Bugs Reporting & Tool Requests: https://bugs.kali.org/
Kali Tool List, Versions & Man Pages: http://tools.kali.org/
2.
1. Stage 3. - DNS
DNS
Domain Name System (DNS) is what is used to lookup
'human readable' names (e.g. www.kali.org), into IP
addresses (allowing for machines to understand the
destination).
In the example below we can see our DNS is pointed to
'192.168.1.151'.
Code:
Note: This guide only covers nameserver. Domain & search is out of scope.
Google:
o 8.8.8.8
o 8.8.4.4
Host file
Before any DNS name service is queried, Kali-Linux checks
the value in the 'hosts file' (/etc/hosts), to see if it contains
any known value. If it finds a local value here, it will not
query the first remote name server in /etc/resolv.conf.
Code:
root@kali ~$ cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 kali
Search: https://www.kali.org/search/
Documentation: http://docs.kali.org/ (Offline PDF version)
Bugs Reporting & Tool Requests: https://bugs.kali.org/
Kali Tool List, Versions & Man Pages: http://tools.kali.org/
A method to do this, is to
'ping' a remote device. We
can do this by sending out a
IMCP echo request, and then
waiting to see if we hear a
IMCP response back.
However, depending on the
remote device that was
choose to be pinged - if they
have a firewall in place and
how its configured, it may
not response back to a IMCP
request.
Code:
root@kali ~$ ping -c 4 google.com
PING google.com (62.252.173.153) 56(84) bytes of data.
64 bytes from m409-mp1-cvx1c.lan.ntl.com
(62.252.173.153): icmp_req=1 ttl=128 time=16.3 ms
64 bytes from m409-mp1-cvx1c.lan.ntl.com
(62.252.173.153): icmp_req=2 ttl=128 time=73.6 ms
64 bytes from m409-mp1-cvx1c.lan.ntl.com
(62.252.173.153): icmp_req=3 ttl=128 time=60.0 ms
64 bytes from m409-mp1-cvx1c.lan.ntl.com
(62.252.173.153): icmp_req=4 ttl=128 time=16.1 ms
Traceroute
This shows the amount of 'hops' (each router/gateway the
packet is passed through), which have been taken to reach
the remote machine (as well as display the path it took).
Note: Each device is separate and may have a firewall
enabled on it, which as a result, will not display their
result.
Code:
root@kali ~$ traceroute www.kali.org
traceroute to www.kali.org (50.116.53.73), 30 hops max,
60 byte packets
1 * * *
2 10.20.252.1 (10.20.252.1) 15.346 ms 15.253 ms
15.143 ms
3 * * *
4 brnt-bb-1c-ae4-0.network.virginmedia.net
(213.106.244.69) 20.310 ms 20.378 ms 18.794 ms
5 brhm-bb-1c-et-410-0.network.virginmedia.net
(62.253.175.210) 20.126 ms brhm-bb-1c-et-700-
0.network.virginmedia.net (62.253.175.206) 21.258 ms
21.514 ms
6 * * *
7 linx.peer.nac.net (195.66.224.94) 92.073 ms
92.301 ms 89.861 ms
8 0.e3-2.tbr2.tl9.nac.net (209.123.11.145) 88.845 ms
90.246 ms 0.e3-2.tbr1.tl9.nac.net (209.123.11.141)
89.182 ms
9 0.e1-4.tbr2.mmu.nac.net (209.123.10.77) 91.806 ms
0.e1-4.tbr1.mmu.nac.net (209.123.10.101) 91.278 ms
0.e1-4.tbr2.mmu.nac.net (209.123.10.77) 93.700 ms
10 vlan805.esd1.mmu.nac.net (209.123.10.34) 94.203 ms
87.709 ms vlan803.esd2.mmu.nac.net (209.123.10.30)
87.830 ms
11 207.99.53.42 (207.99.53.42) 90.761 ms 207.99.53.46
(207.99.53.46) 91.333 ms 91.299 ms
12 cloudproxy81.sucuri.net (50.116.53.73) 149.309 ms
146.124 ms 146.148 ms
root@kali ~$
Search: https://www.kali.org/search/
Documentation: http://docs.kali.org/ (Offline PDF version)
Bugs Reporting & Tool Requests: https://bugs.kali.org/
Kali Tool List, Versions & Man Pages: http://tools.kali.org/
2.
1. Stage 5. - Proxy settings
Depending on your the
network that your connecting
to, you may need to connect
to a proxy to be able to gain
WAN access.
Please double check with
your network administrator if
you're required to do so.
Bash
To configure 'bash' to use the
proxy values (allowing you to
use the network diagnostics
mentioned above - ping &
traceroute), you can do so by
the following commands.
In this example the:
o domain is 'mycompanyname'.
o username is 'g0tmi1k'
o password is 'password2'
o ip is '192.168.1.123'
o port is '8080'
Code:
root@kali ~$ export
http_proxy=http://mycompanyname\g0tmi1k:password2@192.1
68.1.123:8080/
root@kali ~$ export
ftp_proxy=http://mycompanyname\g0tmi1k:password2@192.16
8.1.123:8080/
root@kali ~$
Note: if there isn't any proxy authentication, you can just do 'export http_proxy=http://192.168.1.123:8080/'
Persistent
To make these settings persistent, so you do not need to
keep doing it after every restart, you can alter
'/etc/bash.bashrc' to include the very same comments that
was typed in before.
Apt
The recommend way to keep Kali-Linux up-to-date is by
updating it using the repository. Kali-Linux uses 'apt' for its
package manager. To configure apt to use the proxy values,
we need to alter '/etc/apt/apt.conf'.
Search: https://www.kali.org/search/
Documentation: http://docs.kali.org/ (Offline PDF version)
Bugs Reporting & Tool Requests: https://bugs.kali.org/
Kali Tool List, Versions & Man Pages: http://tools.kali.org/
1. Stage 6. - Virtual machine network
adapter
If your using Kali-Linux in a
virtual machine - you may
wish to double check the
settings on the virtual
network adapter.
Note: There are various virtual machines solutions, however
this guide will only cover: VMware
Fusion/Player/Workstation & Virtual Box
Search: https://www.kali.org/search/
Documentation: http://docs.kali.org/ (Offline PDF version)
Bugs Reporting & Tool Requests: https://bugs.kali.org/
Kali Tool List, Versions & Man Pages: http://tools.kali.org/