1

I start with the following:

ens33     Link encap:Ethernet  HWaddr 00:0c:29:03:a8:56  
          inet addr:192.168.0.161  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::dfa6:820:b035:a36a/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:43 errors:0 dropped:0 overruns:0 frame:0
          TX packets:78 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:4957 (4.9 KB)  TX bytes:8702 (8.7 KB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:204 errors:0 dropped:0 overruns:0 frame:0
          TX packets:204 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:15089 (15.0 KB)  TX bytes:15089 (15.0 KB)

And I want to set my address to a specific value, so that I can identify it easily from other systems when SSHing. I run:

ifconfig ens33 192.168.10.2 netmask 255.255.255.0
route add default gw 192.168.10.1

And the result is:

ens33     Link encap:Ethernet  HWaddr 00:0c:29:03:a8:56  
          inet addr:192.168.10.2  Bcast:192.168.10.255  Mask:255.255.255.0
          inet6 addr: fe80::dfa6:820:b035:a36a/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:147 errors:0 dropped:0 overruns:0 frame:0
          TX packets:146 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:20559 (20.5 KB)  TX bytes:14302 (14.3 KB)

As a result, I'm losing internet connection, and the machine is also not discoverable within the network.

What am I doing wrong?

Update 1

Per @Tomasz's suggestion, I changed the router's mask to 255.255.0.0. I am now running:

ifconfig ens33 192.168.10.2 netmask 255.255.0.0 up
route add default gw 192.168.10.1 ens33

Unfortunately, same effect.

  • And I guess you should add up at the end of the ifconfig line. – Tomasz Jun 12 at 23:27
  • What OS is that? Are you using the NetworkManager? – Tomasz Jun 12 at 23:35
  • It's Ubuntu running in VMWare. These are the default values. – Alexander George Jun 12 at 23:35
  • That's a strange IP for a VM. Is the connection bridged? What IP do you have on the host machine (the "outer" OS)? – Tomasz Jun 12 at 23:39
  • Yes, it's bridged. I wanted it to be independent of the host OS. – Alexander George Jun 12 at 23:41
3

Assuming you are allowed to assign yourself an IP, and I don't know if you've been doing this correctly, your netmask:

Mask:255.255.255.0

In combination with your working IP:

192.168.0.161

Leaves you with this subnet: 192.168.0.0/24, which means you in no way could assign yourself any IP starting 192.168.10.. You could only change the last number in 192.168.0.161.

  • Fair point. I just updated my router's mask to 255.255.0.0 and I'm still having the same problem. I also added the up at the end of the command. – Alexander George Jun 12 at 23:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.