FreeBSD as a router

Hello guys,
I am new to FreeBSD 9.0 and using dhcpd-4.2.3-P1 and I haven't tried making computer a router. I tried doing this by following this tutorial (http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/network-dhcp.html). After trying to start dhcpd I get an error:
Code:
No subnet declaration for re1 (no IPv4 addresses)
What should I do, how to declare those addresses?

P.S. re0 is main ethernet card which gets "internet" and the re1 should share it to my little network (few laptops, ps3).

I would be really glad if anyone could help me.
 
Code:
# dhcpd.conf
#
option domain-name "inet.vub.lt";
option domain-name-servers 8.8.8.8, 8.8.4.4;
option subnet-mask 255.255.255.0;
default-lease-time 3600;
max-lease-time 86400;


ddns-update-style none;


#authoritative;

log-facility local7;
subnet 192.168.4.0 netmask 255.255.255.0 {
range 192.168.4.129 192.168.4.254;
option routers 192.168.4.1;
}

host mail {
  hardware ethernet 50:e5:49:2a:e7:a4;
  fixed-address mailhost.MinSys.lt ;
}

I didn't really got what to write at "fixed-address" so I wrote my system name with "mailhost" in front of it...
 
fixed-address is the static IP address to hand out when a machine with that hardware address (MAC) asks for a DHCP lease.
 
Make sure re1 gets the IP address 192.168.4.1 and it should work.

/etc/rc.conf:
Code:
ifconfig_re1="inet 192.168.4.1 netmask 255.255.255.0"
 
Still get this error:
Code:
No subnet declaration for re1 (no IPv4 addresses).
** Ignoring requests on re1. If this is not what you want, please write a subnet declaration in your
 dhcpd.conf files for the network segment to which interface re1 is attached.

I will add /etc/rc.conf
Code:
dhcpd_enable="YES"
dhcpd_ifaces="re1"
# -- sysinstall generated deltas -- # Thu Apr 12 22:46:47 2012
router_enable="YES"
ifconfig_re0="DHCP"
ipv6_activate_all_interfaces="YES"
gateway_enable="YES"
hostname="MinSys.lt"
ifconfig_re1="inet 192.168.4.1 netmask 255.255.255.0"
 
punktt said:
Still get this error:
Code:
No subnet declaration for re1 (no IPv4 addresses).
** Ignoring requests on re1. ...

For some reason, your DHCP daemon doesn't see this line in your config
Code:
range 192.168.4.129 192.168.4.254;

Typo as SirDice stated before is possible or something other is wrong with your config file. Also host mail section is wrong, there should be ip address in fixed-address, remove this section completely until you get basic DHCP offers working.
 
I have commented:
Code:
range 192.168.4.129 192.168.4.254;

So fixed-address should be my ip address (or maybe gateway's address?), right?
 
punktt said:
So fixed-address should be my ip address (or maybe gateway's address?), right?

Did you ever bother to read what others write to you? As wblock said earlier - fixed-address is address, which will be offered to machine with given MAC if it will request address assignation.
 
This message may be caused by a dhcpd startup having the interface without an IP address within the declared subnet. dhcpd.conf looks fine, but if your re1 interface has no address in 192.168.4.0/24, then you will receive that error message.
Complains about no IP address for re0 are fine.
Post your runtime configuraton for re1:
Code:
/sbin/ifconfig re1
 
Code:
/sbin/ifconfig re1
output:

Code:
re1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	options=389b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_UCAST,WOL_MCAST,WOL_MAGIC>
	ether f8:d1:11:02:98:da
	nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
	media: Ethernet autoselect (none)
	status: no carrier
 
Your interface does not have the desired IP address assigned to it. Here's how it should look the command output:
Code:
> /sbin/ifconfig bge1
bge1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	options=8009b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,LINKSTATE>
	ether 00:30:05:9c:c7:6c
	[color="Red"]inet 10.16.0.1 netmask 0xfffffc00 broadcast 10.16.3.255[/color]
	media: Ethernet autoselect (1000baseT <full-duplex>)
	status: active
Try setting the address manually, then restart dhcpd.
Code:
/sbin/ifconfig re1 inet 192.168.4.1/24
/usr/local/etc/rc.d/isc-dhcpd restart
If dhcpd will start without the error message, you will have to check what is wrong in /etc/rc.conf.
 
Code:
Not searching LDAP since ldap-server, ldap-port and ldap-base-dn were not specified in the config file
Wrote 0 deleted host decls to leases file
Wrote 0 new dynamic host decls to leases file
Wrote 1 leases to leases file
Listening on BPF /re1/f8:d1:11:02:98:da/192.168.4.0/24
Sending on BPF /re1/f8:d1:11:02:98:da/192.168.4.0/24
Sending on Socket/fallback/fallback-net

Is it possible that it's the problem of firewall rules?
 
This startup message is fine. If you add
Code:
dhcpd_flags="-q"
to /etc/rc.conf, the startup should be clean, displaying only errors. The messages about LDAP are OK, informational, as long as you don't use LDAP. I see you already have a working client (1 lease).
 
You are right, my PC is connected to router, because when I ping IP which ISP gave me I get feedback, but when I try to ping "internet" I don't get any. I tried pinging both IP's and domains, because I thought maybe it is some kind of DNS problem. Any ideas?

P.S. DHCPD stars without any error after I added this line:

Code:
dhcpd_flags="-q"
 
Check if /etc/rc.conf contains
Code:
gateway_enable="YES"
(or look for an uncommented net.inet.ip.forwarding=1 in /etc/sysctl.conf) and make sure you have configured NAT.
 
There is still a problem with IPTV. Ports are wide open, but I can't watch IPTV, maybe I should have edited something?

P.S. How to edit my post?
 
Back
Top