0

I am following along with the book Linux Basics for Hackers (No Starch Press, 2018) using Kali Linux (2019.1a) with VirtualBox and when changing my network info (chapter 3) I am no longer able to access the internet.

Here is what I did:

$ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.0.2.15  netmask 255.255.255.0  broadcast 10.0.2.255
        inet6 fe80::a00:27ff:fe77:94b  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:77:09:4b  txqueuelen 1000  (Ethernet)
        RX packets 15771  bytes 18253966 (17.4 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 4016  bytes 243513 (237.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 20  bytes 1116 (1.0 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 20  bytes 1116 (1.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

$ ping google.com
PING google.com (172.217.25.142) 56(84) bytes of data.
64 bytes from syd15s03-in-f14.1e100.net (172.217.25.142): icmp_seq=1 ttl=63 time=23.10 ms
64 bytes from syd15s03-in-f14.1e100.net (172.217.25.142): icmp_seq=2 ttl=63 time=23.4 ms
^C
--- google.com ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1ms
rtt min/avg/max/mdev = 23.351/23.655/23.959/0.304 ms
$ # Change IP from 10.0.2.15 to 10.0.2.21
$ ifconfig eth0 10.0.2.21 netmask 255.255.255.0 broadcast 10.0.2.255
$ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.0.2.21  netmask 255.255.255.0  broadcast 10.0.2.255
        inet6 fe80::a00:27ff:fe77:94b  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:77:09:4b  txqueuelen 1000  (Ethernet)
        RX packets 230432  bytes 263807948 (251.5 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 58741  bytes 3535449 (3.3 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 20  bytes 1116 (1.0 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 20  bytes 1116 (1.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

$ ping google.com
ping: google.com: Name or service not known

I have double checked the commands from the book, and everything I did seems to match.

How can I change my network info and not kill my network/internet access?

1 Answer 1

0

Don't try this in a remote session!!!

When changing the ip address of eth0, which is also the interface
for your default route, you will have to change that too.

Something like this:

# ifconfig eth0 down
# route del default
# ifconfig eth0 10.0.2.21 netmask 255.255.255.0 broadcast 10.0.2.255
# route add default eth0

This is from memory, so you might want to consult the manpages

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .