1d8d3 [Solved] FreeBSD as a router - The FreeBSD Forums
The FreeBSD Forums  

Go Back   The FreeBSD Forums > Server & Networking > Networking

Networking Network related discussions (including general TCP/IP stuff, routing, etc).

Reply
 
Thread Tools Display Modes
  #1  
Old April 12th, 2012, 13:22
punktt punktt is offline
Junior Member
 
Join Date: Apr 2012
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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.ISO...work-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.

Last edited by DutchDaemon; April 12th, 2012 at 14:26. Reason: Proper formatting: http://forums.freebsd.org/showthread.php?t=8816
Reply With Quote
  #2  
Old April 12th, 2012, 14:37
SirDice's Avatar
SirDice SirDice is offline
Moderator
 
Join Date: Nov 2008
Location: Rotterdam, Netherlands
Posts: 13,702
Thanks: 47
Thanked 2,022 Times in 1,861 Posts
Default

Post your dhcpd.conf.
__________________
Senior UNIX Engineer at Unix Support Nederland
Experience is something you don't get until just after you need it.
Reply With Quote
  #3  
Old April 12th, 2012, 18:25
punktt punktt is offline
Junior Member
 
Join Date: Apr 2012
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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...
Reply With Quote
  #4  
Old April 12th, 2012, 23:10
wblock@'s Avatar
wblock@ wblock@ is offline
Moderator
 
Join Date: Sep 2009
Location: Milky Way galaxy
Posts: 7,709
Thanks: 431
Thanked 1,757 Times in 1,456 Posts
Default

fixed-address is the static IP address to hand out when a machine with that hardware address (MAC) asks for a DHCP lease.
Reply With Quote
  #5  
Old April 13th, 2012, 07:42
SirDice's Avatar
SirDice SirDice is offline
Moderator
 
Join Date: Nov 2008
Location: Rotterdam, Netherlands
Posts: 13,702
Thanks: 47
Thanked 2,022 Times in 1,861 Posts
Default

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"
__________________
Senior UNIX Engineer at Unix Support Nederland
Experience is something you don't get until just after you need it.
Reply With Quote
  #6  
Old April 13th, 2012, 09:23
punktt punktt is offline
Junior Member
 
Join Date: Apr 2012
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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"

Last edited by DutchDaemon; April 13th, 2012 at 22:16. Reason: Use [FILE], not [COLOR]
Reply With Quote
  #7  
Old April 13th, 2012, 09:29
SirDice's Avatar
SirDice SirDice is offline
Moderator
 
Join Date: Nov 2008
Location: Rotterdam, Netherlands
Posts: 13,702
Thanks: 47
Thanked 2,022 Times in 1,861 Posts
Default

There's probably a typo in your dhcpd.conf.
__________________
Senior UNIX Engineer at Unix Support Nederland
Experience is something you don't get until just after you need it.
Reply With Quote
  #8  
Old April 13th, 2012, 09:46
ondra_knezour ondra_knezour is offline
Member
 
Join Date: Nov 2008
Location: Prague, Czech Republic, Europe
Posts: 215
Thanks: 9
Thanked 29 Times in 28 Posts
Default

Quote:
Originally Posted by punktt View Post
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.
Reply With Quote
  #9  
Old April 13th, 2012, 11:17
punktt punktt is offline
Junior Member
 
Join Date: Apr 2012
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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?

Last edited by DutchDaemon; April 13th, 2012 at 22:18. Reason: Use [FILE], not [COLOR]
Reply With Quote
  #10  
Old April 13th, 2012, 11:44
ondra_knezour ondra_knezour is offline
Member
 
Join Date: Nov 2008
Location: Prague, Czech Republic, Europe
Posts: 215
Thanks: 9
Thanked 29 Times in 28 Posts
Default

Quote:
Originally Posted by punktt View Post
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.

Last edited by DutchDaemon; April 13th, 2012 at 22:18.
Reply With Quote
  #11  
Old April 13th, 2012, 16:21
ecazamir ecazamir is offline
Member
 
Join Date: Mar 2009
Posts: 215
Thanks: 5
Thanked 28 Times in 26 Posts
Default

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
__________________
My blog: http://ghid-it.blogspot.com
Other guides: http://sites.google.com/site/ghidit/

Last edited by DutchDaemon; April 13th, 2012 at 22:19.
Reply With Quote
  #12  
Old April 14th, 2012, 07:01
punktt punktt is offline
Junior Member
 
Join Date: Apr 2012
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
Reply With Quote
  #13  
Old April 14th, 2012, 11:12
ecazamir ecazamir is offline
Member
 
Join Date: Mar 2009
Posts: 215
Thanks: 5
Thanked 28 Times in 26 Posts
Default

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
	inet 10.16.0.1 netmask 0xfffffc00 broadcast 10.16.3.255
	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.
__________________
My blog: http://ghid-it.blogspot.com
Other guides: http://sites.google.com/site/ghidit/

Last edited by DutchDaemon; April 15th, 2012 at 02:28.
Reply With Quote
  #14  
Old April 14th, 2012, 12:24
punktt punktt is offline
Junior Member
 
Join Date: Apr 2012
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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?
Reply With Quote
  #15  
Old April 14th, 2012, 20:31
ecazamir ecazamir is offline
Member
 
Join Date: Mar 2009
Posts: 215
Thanks: 5
Thanked 28 Times in 26 Posts
Default

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).
__________________
My blog: http://ghid-it.blogspot.com
Other guides: http://sites.google.com/site/ghidit/

Last edited by DutchDaemon; April 15th, 2012 at 02:29.
Reply With Quote
  #16  
Old April 14th, 2012, 21:16
punktt punktt is offline
Junior Member
 
Join Date: Apr 2012
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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"

Last edited by DutchDaemon; April 15th, 2012 at 02:29.
Reply With Quote
  #17  
Old April 15th, 2012, 10:48
ecazamir ecazamir is offline
Member
 
Join Date: Mar 2009
Posts: 215
Thanks: 5
Thanked 28 Times in 26 Posts
Default

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.
__________________
My blog: http://ghid-it.blogspot.com
Other guides: http://sites.google.com/site/ghidit/

Last edited by DutchDaemon; April 16th, 2012 at 00:47.
Reply With Quote
  #18  
Old April 16th, 2012, 10:06
punktt punktt is offline
Junior Member
 
Join Date: Apr 2012
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you for help guys, everything is working.
Reply With Quote
  #19  
Old April 18th, 2012, 19:09
punktt punktt is offline
Junior Member
 
Join Date: Apr 2012
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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?
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Solved] FreeBSD Router with PF ryuusoultaker Firewalls 9 January 8th, 2012 08:45
[IPF] Connecting Cisco ASA VPN through FreeBSD 8.2 router vs FreeBSD 7.4 router gilcel Firewalls 0 July 12th, 2011 10:40
FreeBSD router dpetka2001 Networking 17 March 23rd, 2011 21:34
FreeBSD as a router Myron Networking 5 December 6th, 2009 09:51
[Solved] FreeBSD as a router gpatrick Networking 8 October 23rd, 2009 19:55


All times are GMT +1. The time now is 02:37.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
The mark FreeBSD is a registered trademark of The FreeBSD Foundation and is used by The FreeBSD Project with the permission of The FreeBSD Foundation.
Web protection and acceleration provided by CloudFlare
0