# DHCPD and network interfaces



## Airost (Apr 16, 2016)

Hi all,

I am new to FreeBSD system and to forum as well

I've spent 2 days online looking for solution and cannot find anything

Basically I use FreeBSD 10.3 as a server at home instead of router. My broadband is EE Fibre Optic (UK) and I would like to share connection at home. I bought Draytek Vigor 130 for broadband connection and Dell PowerEdge 1950 to run as a server. Also I bought Cisco Access Point WAP4410N to share connection via wireless (i.e. for mobile phones etc). My first adventure with FreeBSD was years ago when my mate did all the job for me on my previous server at home (FreeBSD 7.0) so I kept my firewall config etc. Everything was running nice and smooth until I decided to buy new hardware and learn myself a little bit. I used in the past Linux Red Hat and some other distributions but BSD is nothing like Linux as I noticed.

Now what is my issue?

I have everything connected and every time I reboot machine I don't get IP address from DHCP. I have to manually restart network interface using command

```
ifconfig bce0 down
ifconfig bce0 up
```

Then it's ok but I would like to disconnect server and connect it where it will be staying for a bit longer and do everything remoted. I don't have an access to screen and keyboard in where server will sit and also it's a bit annoying as it should work perfectly.

Next issue is Cisco access point doesn't have internet sharing. Internet works only on the devices connected via cable. I have no idea why? It's set to default at the moment without WPA and I can only receive IP address but no internet.

Once I get that sorted I will have more questions why ALTQ was working fine on FreeBSD 7.0 and it doesn't work on FreeBSD 10.3 even after I compiled kernel as guided online.

Please take a note that I am new and if somebody gonna ask me for log I will need command or path where log is located.

Thanks in advance
Seb


----------



## aragats (Apr 17, 2016)

If you use FreeBSD only as a router you may consider installing pfSense instead (which is a tailored FreeBSD system): 
https://www.pfsense.org/download/
It is very easy to setup and it has a nice web interface.


----------



## Airost (Apr 17, 2016)

Thanks for the reply but that's the thing, I want to learn FreeBSD and I think it's a great system. I hope with such a big community there will be somebody who can assist me with my issues. BTW I managed to get Cisco Access Point working, added route and it works. Not sure if that was the issue but it works.


----------



## da1 (Apr 18, 2016)

Airost said:


> I have everything connected and every time I reboot machine I don't get IP address from DHCP. I have to manually restart network interface using command
> 
> ```
> ifconfig bce0 down
> ...


Please post the content of /etc/rc.conf and no, I will not give you commands and no one should, specially considering the fact that you've stated you want to learn 



Airost said:


> Next issue is Cisco access point doesn't have internet sharing. Internet works only on the devices connected via cable. I have no idea why? It's set to default at the moment without WPA and I can only receive IP address but no internet.


What model do you have and what settings have you made so far?



Airost said:


> Once I get that sorted I will have more questions why ALTQ was working fine on FreeBSD 7.0 and it doesn't work on FreeBSD 10.3 even after I compiled kernel as guided online.


For that, we will need the content of /etc/pf.conf



Airost said:


> Please take a note that I am new and if somebody gonna ask me for log I will need command or path where log is located.


Note taken but: 





Airost said:


> [...] I want to learn FreeBSD[...]


----------



## Airost (Apr 19, 2016)

Here is rc.conf

```
hostname="mclose"
keymap="pl_PL.ISO8859-2.kbd"

#Server SSH
sshd_enable="YES"

#Standard config
ntpd_enable="YES"
#powerd_enable="YES"

# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="AUTO"

#From old server
inetd_enable="YES"

#Network Setup
ifconfig_bce0="inet 172.16.0.1 netmask 255.255.0.0"
ifconfig_bce1="DHCP"


#Server FTP
proftpd_enable="YES"

#Server HTTP
#apache24_enable="YES"

#Server SAMBA
samba_enable="YES"

#Internet forwarding
gateway_enable="YES"
default_router="YES"
defaultrouter="192.168.1.2"

#DNS for Clients
#named_enable="YES"
#named_flags="-u bind"
#named_chrootdir="" #inhibits chroot

#Server DHCP
dhcpd_enable="YES"
dhcpd_flags="-q"
dhcpd_conf="/usr/local/etc/dhcpd.conf"
dhcpd_ifaces="bce0"
dhcpd_withumask="022"

#Firewall
pf_enable="YES"
pf_flags=""
pf_rules="/etc/pf1.conf"
pf_program="/sbin/pfctl"
pflog_enable="YES"
pflog_logfile="/var/log/pflog"

#From old server
router="routed"
linux_enable="YES"

#No-IP
noip_enable="YES"
```


----------



## Airost (Apr 19, 2016)

Access Point is Cisco WAP4410N but what I just noticed after restarted my server couple of times it works fine with no issues. My issue was wireless adapter on my laptop with old driver (Intel Centrino 6300 agn), read forum, updated drivers and now no issues.

BTW on my pf.conf


```
#BitComet
rdr on $wan_if proto tcp from any to any port 6881:6889 -> 172.16.0.7 port 6881:6889
rdr on $wan_if proto udp from any to any port 6881:6889 -> 172.16.0.7 port 6881:6889
```

It doesn't work, any idea why? I've got yellow spot (behind firewall)

Next thing added ALTQ options, compiled kernel and firewall doesn't want to load lines below


```
#
# AltQ - upload:
#
#########################

altq on $wan_if cbq bandwidth 102400Kb queue { std_out,  \
  komp1_out  }
queue std_out  cbq(default)
queue komp1_out  bandwidth 102400Kb cbq(red)



#
# AltQ - download:
#
#########################

altq on $lan_if cbq bandwidth 100Mb queue {  std_in,  \
  komp1_in  }
queue std_in  cbq(default)
queue komp1_in  bandwidth 50Mb cbq(red)
```

Tried all different ways and on my previous server I could limit bandwidth for users and now it says No parent if I load those lines. At the moment I just left lines with # on front so pf.conf can be loaded


----------



## da1 (Apr 21, 2016)

So let's take it one step at a time shall we.

1) network not coming up
I would say to first, remove the following from /etc/rc.conf:
	
	



```
default_router="YES"
router="routed"
```

I checked /etc/defaults/rc.conf and those 2 options are not there. If they have any specific purpose, maybe you can explain.

Apart from that, the /etc/rc.conf looks good. I would suggest you check the userland messages from `dmesg -a` to get more info on the network part.

2) pf rdr


> It doesn't work, any idea why? I've got yellow spot (behind firewall)


 Because you didn't specify a pass rule. You can do something like this:

```
rdr on $iface from <src> to <dst> -> <rdr_ip> <port>
# and then pass
pass in on <rdr_ip> blah blah

# or 1 rule
rdr pass in on ... blah blah
```
Try that.

3) ALTQ
Checkout the queuing method used here: https://calomel.org/pf_config.html


----------



## Airost (Apr 30, 2016)

Thanks for your help,

1) removed as advised. Don't know why I had those lines in rc.conf
2) Still working on it. I had firewall on my modem Draytek Vigor 130 set to on. Now I have upgraded firmware, configured PPPoE connection and I can ping my IP and also use ssh outside local network
3) ALTQ wasn't compiled to kernel as I noticed after days and nights. Now it is all working but I have message:

```
pfctl: the sum of the child bandwidth higher than parent "root_bce0"
```

Will try to redirect port and I will come back with an update


----------

