Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have a public ip as below which is static (my isp provided) as below:

IP Address: x.x.146.50
Subnet Mask:    255.255.255.240
Default Gateway:    x.x.146.49
DNS1:   x.x.1.196
DNS2:   x.x.7.196

But what is my Network, Broadcast and DNS (this scared me for ages, looking for a easy way to do 100% accurate calculating/math).

iface eth0 inet static
    address x.x.146.50
    netmask 255.255.255.240
    network ????????????
    gateway x.x.146.49
    broadcast ?????????

Follow up: (short cut)

$ ipcalculator 8.8.8.8/28
Address:   8.8.8.8              00001000.00001000.00001000.0000 1000
Netmask:   255.255.255.240 = 28 11111111.11111111.11111111.1111 0000
Wildcard:  0.0.0.15             00000000.00000000.00000000.0000 1111
=>
Network:   8.8.8.0/28           00001000.00001000.00001000.0000 0000
HostMin:   8.8.8.1              00001000.00001000.00001000.0000 0001
HostMax:   8.8.8.14             00001000.00001000.00001000.0000 1110
Broadcast: 8.8.8.15             00001000.00001000.00001000.0000 1111
Hosts/Net: 14                    Class A

1) It tells me Broadcast what to copy and paste
2) It tells me Netmask what to copy and paste
3) It tells me Network what to copy and paste

Now its Easy! i was always finding them complex in my head to do manual calculation and server is down for 20 days :P. Not not anymore.

share|improve this question
add comment

3 Answers 3

up vote 3 down vote accepted

Your network is x.x.146.48 and your broadcast x.x.146.63.

Network and broadcast can be derived from ip and netmask. Netmask is used to separate the IP in two different segments (they are called network and host). If you look at your netmask in binary it looks like:

11111111.11111111.11111111.1111000

The ones mark the network segment, the zeros the host. You IP in binary is (I'm not going to translate the 146 as it is fully part of the network address):

x.x.146.0011-0010

From the netmask we know the last four digits is you host address, so your networks is.

x.x.146.0011-0000 or 48

The broadcast address is the same that the network one but with all the host bits at 1.

x.x.146.0011-1111 or 63

You can found much more info about ip routing and subnets in wikipedia.

share|improve this answer
    
Thank you its working. See my edit with my calculation i was confused, but your hints was excellent thanks a lot. –  YumYumYum Jan 5 '12 at 20:26
add comment

Just use the NetworkManager GUI. I don't think you're quite ready to handle the Debian-style configurations in /etc.

share|improve this answer
    
Please see the edit, i did that. –  YumYumYum Jan 5 '12 at 20:26
add comment

You don't need network and broadcast. It is for hosting a lan. As you connect directly to the ISP you need only gateway, address, netmask. I connect to my ISP the same way. You need to write the dns to the /etc/resolv.conf

share|improve this answer
    
Sometimes it get automatically two lines in that file. But to explicity add more, you can add as much as you want right :)! –  YumYumYum Jan 5 '12 at 20:28
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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