Wednesday 18 December 2019

linux - The network setting for /etc/network/interfaces for static IP of a supernet address


I want to change my Ubuntu to static IP. My current IP setting is:


eth0      Link encap:Ethernet  HWaddr 00:0c:29:xx:xx:xx  
inet addr:192.168.16.59 Bcast:192.168.31.255 Mask:255.255.240.0
inet6 addr: fe80::20c:xx:xx:xx/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:234690 errors:0 dropped:0 overruns:0 frame:0
TX packets:1864 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:22953435 (22.9 MB) TX bytes:205616 (205.6 KB)

what should I put as the network in /etc/network/interfaces (note the network mask of 255.255.240.0)?



Answer



If I'm understanding your question, to set a static IP, your network runs from 191.168.16.1 - 191.168.31.254, with the identity address at 192.168.16.0 and the broadcast at 192.168.31.255. I've never had to use the Network keyword, but I've never used a supernet address on a host. I've only seen them used for route aggregation.


 auto eth0
iface eth0 inet static
address 192.168.16.59
network 192.168.16.0
netmask 255.255.240.0
broadcast 192.168.31.255
gateway 192.168.0.1

No comments:

Post a Comment

How can I VLOOKUP in multiple Excel documents?

I am trying to VLOOKUP reference data with around 400 seperate Excel files. Is it possible to do this in a quick way rather than doing it m...