# $BCAST?

## rommel

whats this number...like for my wireless connection i have a static IP ,subnet mask , gateway, and primary and secondary dns numbers. but i have no idea what a broadcast number is.

----------

## pjp

ifconfig -a reports it.

----------

## rommel

good enough, but can this number be gotten from the machine before it actually has been entered in?...in other words if you are setting up a new system and configuring the internet connectivity and the broadcast number is part of this setup procedure , well i think you can see what i am getting at.

i have gentoo on a home network and this machine gives me a BCAST of 192.168.0.255 , would it remain the same for all machines on my network?

----------

## pjp

The broadcast address stays the same for all hosts on a subnet.

See if this helps.

----------

## rommel

well i am not having much luck with this....i boot from the 1.2-x86 iso and then i run the pci detection...it shows my 3com card i then do

```
#insmod pcmcia_core 

     #insmod i82365  

     #insmod ds 

     #cardmgr -f
```

....my orinoco card beeps and its all seen but when i go to setup the internet connection 

```
#/sbin/ifconfig $eth1 $64.68.166.105 broadcast $192.168.0.255 netmask $255.255.255.0
```

i get that it cant find module 4.68.166.105, i must be screwing the syntax really bad but i am not sure...i tried different things but with no success....anyone?

ciao

----------

## rac

 *rommel wrote:*   

> 
> 
> ```
> #/sbin/ifconfig $eth1 $64.68.166.105 broadcast $192.168.0.255 netmask $255.255.255.0
> ```
> ...

 

First off, lose the '$' before the IP addresses (and before eth1), unless those are typos.  Secondly, the broadcast address must be the result of setting all relevant bits in your network address to 1.  For example, if your IP address were 192.168.0.17, and netmask was 255.255.255.0, then a broadcast address of 192.168.0.255 makes sense, but with an IP address of 64.68.166.105 and a netmask of 255.255.255.0, the broadcast address would have to be 64.68.166.255.  Sorry if this is unclear.

----------

## rommel

no not unclear at all....i did try loosing the $ before the IPNUM and BCAST...i was following the instructions literally the first time then i started experimenting....but i will try it again witht eh bcast number you suggested based on the ip and mask i posted

----------

## kashani

looks like you have a few problems on your command line. 

1. First get rid of any $. You're coniguring your card from the command line not writing a script. 

2. I'd verify that your network card is actually eth1.

3. IP networking

The broadcast is the last IP on YOUR subnet. Your IP is 64.68.166.105 and your netmast is 255.255.255.0. The netmask indicates that your network contains 256 addresses. 

The quick rule of thumb for simple networking is 

(256 - last number of subnet ) = # of IP addresses

Since IP's are numbered from 0-255, 255 is the last IP in the range. 

So your final command line would be 

/sbin/ifconfig eth1 64.68.166.105 netmask 255.255.255.0 broadcast 64.68.166.255

kashani

----------

## rommel

well that all worked, but i am not able to get anything recognized after the first boot.

during the initialization of eth1 it fails saying there is no such device , but when i ran /sbin/ifconfig eth1 during the install it all worked fine....i am sure its some thing simple i am leaving out.

the reason its eth1 is after running cardmgr -f that what it came up with...eth0 is apparently my 3 com nic that works but only runs toa  switch...i am trying to set up ics like i had win2k doing on this machine...just to do it really...so i will keep reading...any posts though hints or links would be great

ciao

edit:How do I get my orinoco card and pcmcia-cs to play nicely?

Step 1: Configure your kernel withOUT PCMCIA/Cardbus support and withOUT support for your network card then compile your kernel.

Step 2: emerge pcmcia-cs

Step 3: Double check the following files to make sure they are set for your network conditions: /etc/init.d/net and /etc/conf.d/pcmcia

Step 4: Reboot and perform the following commands: insmod pcmcia_core

insmod i82365

insmod ds

cardmgr -f

Step 5: Step 4 should have brought your networking to life. To get networking on boot add the modules that you manually insmod'ed to the file /etc/modules.autoload

Please note that this answer was basically plagerized from a post by marthisdil in this thread.

Back to top

this is apparently where i may have gone wrong...lolLast edited by rommel on Wed Sep 11, 2002 8:36 pm; edited 1 time in total

----------

## rac

 *rommel wrote:*   

> during the initialization of eth1 it fails saying there is no such device , but when i ran /sbin/ifconfig eth1 during the install it all worked fine....i am sure its some thing simple i am leaving out.

 

Probably your kernel is missing the driver for whatever eth1 is, or if it's a module, then the module hasn't been loaded.

----------

## pjp

 *rommel wrote:*   

> well that all worked, but i am not able to get anything recognized after the first boot.
> 
> during the initialization of eth1 it fails saying there is no such device , but when i ran /sbin/ifconfig eth1 during the install it all worked fine....i am sure its some thing simple i am leaving out.

 This usually indicates incorrect support (kernel or module) for the NIC.

----------

## rommel

well yeah.....i would think so. but the wireless pcmcia card in the host adapter (this is in a desktop not a laptop) would be seen more or less like an ethernet card yes?

----------

## rommel

well i have it working , but i have to do a #cardmgr -f to get the pcmcia card to actually activate after the system boots...the odd thing is that eth1 obviously fails to load during boot but /sbin/ifconfig eth1 after cardmgr -f is executed produces a 'working' eth1...when i got o shutdown or reboot i get a fail to stop eth1 cuz it was never started. 

should i have to maually start teh pcmcia using cardmgr everytime or is there a script to automatically automate this, and why does eth1 get the up adn running ok but gives a messege or never having been started on shutdown...i am gonna go read about masquerading now...lol

----------

## pjp

How about pcmcia-cs instructions for Gentoo users.?

----------

## splooge

Just a little history.

When the internet was first invented, there were no such things as subnet masks and broadcast addresses ( ... well, there were broadcast addresses, but before the era of subnet masks you didn't really need to know your broadcast adderss) .

You had 3 (well, more, but not important to this) types of addresses.  Class A, B and C.  A class A network consists of an 8 bit network (n) address and a 24 bit host (h) address:

nnnnnnnn.hhhhhhhh.hhhhhhhh.hhhhhhhh

Class B is a 16 bit network address with a 16 bit host address:

nnnnnnnn.nnnnnnnn.hhhhhhhh.hhhhhhhh

Class C is a 24 bit network adderss with 8 bits for hosts:

nnnnnnnn.nnnnnnnn.nnnnnnnn.hhhhhhhh

This was OK at first, but then they realized what a waste of space the class A addresses were.  The solution to this problem was: subnet masks.  

So, instead of having to have an entire class a network on ONE physical network, we are now allowed to SUBNET that network, this is where subnet masks come in.

First, some basic info:

Your average class A subnetmask: 255.0.0.0

Your average class A broadcast address: x.255.255.255 (where x = your network)

Your average class B subnetmask: 255.255.0.0

Your average class B broadcast address: x.x.255.255 (where x.x = your network)

And the most common setup, a class C address:

Subnetmask 255.255.255.0

Broadcast address x.x.x.255 (where x.x.x = your network)

Now a class A address (let's take 12.17.37.81 for example)  would have to be on the same network as what? 255*555*255 other PCs?  Well, they realized this was a huge waste of space eventually, and no one would want that big of a network on one segment anyways.  

This is how they broke down the huge networks: subnet masks.  It involves "reaching into" the host address field and stealing a bit (or 6).  For an example:

Our class A address 12.17.37.1 would normally be on a network with a billion (not really) other computers (12.*.*.*) but introducing the subnet masks, say we want to share some of our IPs with our friend across the street on a totally different network.  No problem!  So the larger ISPs can now sell a class A SUBNETTED network with subnet masks, they could assign them anything in their range, let's say 12.17.37.0/24

First of all, notice that 12.13.37.0 is a class A network address.

HOWEVER, The /24 means you are going to be using the first 24 bits as as network, and the remaining bits as the hosts.  In this case, your network would be the above address (ending in 0), your subnet mask would be 255.255.255.0, and your broadcast address would be 12.13.37.255  *This is not a class C address, it's a subnetted class A address*

Now, onto a little trickier things.  What if an ISP doesn't assign you a full 256 IP addresses?  Well this is very common, and we can subnet down further than 256 hosts.  For example:

12.13.37.80/28 (Or reaching 28 bits into the address) is a class A address that has been subnetted by using a subnet mask of 255.255.255.240.  The first IP is 12.13.37.81, and the broadcast IP is 12.13.37.95.  All IPs between those two numbers are usable on your network, 81-94

bitwise the network address looks like this: (Notice all 0's at the end)

(00001100.00001101.00100101.0101) (0000)

The first machine on your network would be:

(00001100.00001101.00100101.0101) (0001)

Your broadcast address: (goes to EVERY machine on the network (Notice all 1's)

(00001100.00001101.00100101.0101) (1111)

So valid subnet masks can ONLY have the numbers:

0

128

192

224

240

248

252

otherwise they're filtering the wrong bits!

Sorry for the rant, I'm no teacher, so it probably didn't make sense anyways ;p

----------

## rommel

well rant a little on setting up this system to act as a router for my home network...lol

i am looking at the telephone book sized howto right now on masquerading?....i guess thats what i need for the equivilant of ICS in windows.

i have the on the router/gatway machine the pcmcia/hostadapter connecting to my isp and after reading the link kanuslupus posted everything loads fine at boot , also in the box is a 3com ethernet card that connects to a 5way switch that my other systems connect to.

still upon shutting down or rebooting i get the failed to shutdown eth1 cuz it was never started error messege...any clue why it can access the internet and /sbin/ifconfig eth1 shows it working but i still get this messege

----------

## rommel

well i am kinda stuck....i am not sure why but i cannot ping my isp from my client ....i can ping the client from the host and can ping the host eth0 nic card from the client well enough but i am unable to ping my isp from the client...the only thing that appears to be wrong is that when cardmgr shuts down it says it cant stop eth1 because it has not yet been started...but eth1 is my orinoco pcmcia card with its host adapter and eth0 in the host machine is a 3com nic...i am able to use lynx from the host so the eth1 connection throught hte pcmcia card is working fine...anyone have any suggestions? i ahve not yet even tried installing a firewall/iptable script i was just trying to get the networking strait first, ip_forward is enabled as best i can tell....#echo "1" > /proc/sys/net/ipv4/ip_forward, so cat /proc/sys/net/ipv4/ip_forward returns a 1.

ciao

----------

## rommel

no one have a suggestion , or is this too ignorant to answer?

----------

## pjp

 *rommel wrote:*   

> i cannot ping my isp from my client ....i can ping the client from the host and can ping the host eth0 nic card from the client well enough but i am unable to ping my isp from the client...
> 
> ...
> 
> i am able to use lynx from the host so the eth1 connection throught hte pcmcia card is working fine...

 OK, just to clarify what is and isn't working.  The host can ping your ISP, but the client cannot?  Have you tried to ping the ISP from the client using the IP and hostname?

----------

## rommel

no i havent...what would the syntax look like

```
#ping dakotainet.net 64.68.166.1
```

 and to tell you the truth i am not sure if i was able to ping my isp from my host although i think i tried...i am able (using eth1 ,the orinoco setup) to emerge and access the net with lynx. everything else seemed to work except from client machine 192.168.0.2 to isp that was listed in the above code...but i will play with it some more after i finish work and post if i find anything different. 

thanks

----------

## pjp

```
#ping dakotainet.net
```

 and 

```
#ping 64.68.166.1
```

Check from the host machine first, then client.

----------

## sn1987a

 *rommel wrote:*   

>  i ahve not yet even tried installing a firewall/iptable script i was just trying to get the networking strait first,
> 
> ciao

 

Do you have the iptables nat table configured? You need to have something like:

iptables -t nat -A POSTROUTING -i -o eth1 -s 192.168.0.0/24 -j SNAT --to-source 64.68.166.105

This says to make anything going out eth1 (to the internet) from the internal address gets nat'ed to look like its from your gateway.  The SNAT is correct for a static IP, dynamic IPs should you MASQUERADE.

One other possible source of problems is if the default policy on the FORWARD table is DENY

----------

## rommel

i havent entered in any iptable stuff....only what i said above about enabling forwarding with  #echo "1" > /proc/sys/net/ipv4/ip_forward....where do you issue or how do you issue the iptabel nat stuff you posted...i am not sure how or where to put the commands so that they get read at boot...would you enter that line in local.start?

----------

## RebelYell

 *rommel wrote:*   

> whats this number...like for my wireless connection i have a static IP ,subnet mask , gateway, and primary and secondary dns numbers. but i have no idea what a broadcast number is.

 

There's a tiny utility for calculating subnets, broadcast numbers, netmasks, etc.

```

emerge cidr

```

I hope this helps.

Regards,

Rebel Yell

----------

## rommel

well i am in lynx on the host machine and when i enter 

```
iptables -t nat -A POSTROUTING -i -o eth1 -s 192.168.0.0/24 -j SNAT --to-source 64.68.166.105
```

 i get 2 errors 

```
Warning: weird character in interface '-o' (No alaises,:,!,or *)

Bad argument 'eth1'
```

 looking at sysctl.conf should i uncomment the forawarding and change the number to '1', i am gonna keep playing and reading but any suggestions would be great.

edit:i am still (at shutdown or reboot) getting that cardmgr ./network check eth1 error that says it was never started so it cant shut it down.....eht1 is what is given to the orinoco card automatically like if i bring up dmesg thats whats listed during the probe so what is stoping cardmgr from seeing it correctly?

----------

## sn1987a

 *rommel wrote:*   

> well i am in lynx on the host machine and when i enter 
> 
> ```
> iptables -t nat -A POSTROUTING -i -o eth1 -s 192.168.0.0/24 -j SNAT --to-source 64.68.166.105
> ```
> ...

 

My mistake, sorry   :Embarassed:   remove the -i.  

As far as sysctl.conf, you will want to have it automatically set forwarding.

----------

## rommel

cool...and no need to appologize...i appreciate your help

edit: man thanks for your help...i am posting this from a client with gentoo as the host , its all working now. thanks again for checking back ! now to make a good firewall script.

----------

