Re: iptables and dhcp configuration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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


[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux