|
|
Re: iptables and dhcp configuration |
On 8/8/2012 5:56 AM, Jatin K wrote:
Dear all,is there any way or method available to configure iptables to allow only dhcp server assigned ip , means if user manually sets his/her systems ip address then Linux gateway(FC16) should reject it . user must use the ip address which is assigned by dhcp, ( dhcp server is running on the same machine where iptables are installed, and machine is acting as a gateway )Warm Regards
Put this in your dhcpd.conf to record the IP address issue in an ipset:
on commit {
set ClientIP = binary-to-ascii(10, 8, ".", leased-address);
# set ClientMac = binary-to-ascii(16, 8, ":",
substring(hardware, 1, 6));
set ClientLeaseTime = binary-to-ascii(10, 32, "",
encode-int(lease-time, 32));
# set ClientLeaseTime = encode-int(lease-time, 32);
# set ClientLeaseTime = "14400";
execute (
"/usr/sbin/ipset",
"-A", "DHCPuser",
concat (ClientIP, ",", ClientLeaseTime)
);
}
You'll probably have to change the execute command to work with the new
syntax of ipset.
Then use the functionality of iptables to use the ipset to allow/deny access. I use Shorewall for my firewall which makes it pretty easy.
Bill -- users mailing list users@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe or change subscription options: https://admin.fedoraproject.org/mailman/listinfo/users Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines Have a question? Ask away: http://ask.fedoraproject.org
[Older Fedora Users] [Fedora Announce] [Fedora Package Announce] [EPEL Announce] [Fedora News] [Fedora Cloud] [Fedora Advisory Board] [Fedora Education] [Fedora Security] [Fedora Scitech] [Fedora Robotics] [Fedora Maintainers] [Fedora Infrastructure] [Fedora Websites] [Anaconda Devel] [Fedora Devel Java] [Fedora Legacy] [Fedora Desktop] [Fedora Fonts] [ATA RAID] [Fedora Marketing] [Fedora Management Tools] [Fedora Mentors] [SSH] [Find Someone Special] [Fedora Package Review] [Fedora R Devel] [Fedora PHP Devel] [Kickstart] [Fedora Music] [Fedora Packaging] [Centos] [Fedora SELinux] [Fedora Legal] [Fedora Kernel] [Fedora QA] [Fedora Triage] [Fedora OCaml] [Coolkey] [Virtualization Tools] [ET Management Tools] [Yum Users] [Tux] [Yosemite News] [Yosemite Photos] [Linux Apps] [Maemo Users] [Gnome Users] [KDE Users] [Fedora Tools] [Fedora Art] [Fedora Docs] [Maemo Users] [Asterisk PBX] [Fedora Sparc] [Fedora Universal Network Connector] [Libvirt Users] [Fedora ARM]
![]() |
![]() |