Add ARP Entries Permanently in PFSense



  • If your using latest version of PFSense, their is additional Options(Shell) in Console Menu. By using Shell, I used to add static arp entry using this command arp -s 1.1.1.1 3b:xx:xx:xx:xx:xx:xx. Every thing is fine until I reboot the firewall the ARP entry was lost. Is there any shell command to save permanently the ARP entries?


  • Banned

    Use the ShellCmd package for similar messing.



  • This isn't a direct answer to the question but may help you get there.

    The "ARP Table Static Entry" check box option in "Services: DHCP: Edit static mapping" adds static ARP entries and saves them in the config as show in the following example.
    "Create an ARP Table Static Entry for this MAC & IP Address pair."

    Perhaps in addition to adding the entry via arp command you could manually add it to the config.  But be aware that to make manual changes to the config stick additional steps may be required to get it in sync with the loaded/running config so that the manual changes don't get clobbered.

    
    	 <dhcpd><lan>. . .
    			 <staticmap><mac>ff:ff:ff:ff:ff:ff</mac>
    				<ipaddr>192.168.2.254</ipaddr>
    				<hostname>Broadcast-Agent</hostname>
    
    				 <arp_table_static_entry><filename><rootpath></rootpath></filename></arp_table_static_entry></staticmap></lan></dhcpd> 
    


  • It may be possible to create a shell script to run after boot up that adds the entry too.

    In the config this would be under:

    
    	 <system>. . .
    		<afterbootupshellcmd>/vvar/After_Bootup_Shell_Cmds.sh</afterbootupshellcmd></system> 
    

    shell script file: /vvar/After_Bootup_Shell_Cmds.sh

    
    #!/bin/sh
    
    # After Bootup Shell Commands Script
    
    


  • I dont used DHCP. Can you please give me steps on how to edit the config and the location of it.



  • Not 100% certain but DHCP may not be necessary in order to use the ARP table static map feature. 
    Pretty sure the entry would be saved in the config.  Question is will it be applied at restart if DHCP is not enabled on the interface.  May be worth a try.

    Anyway the conf is located at /cf/conf/config.xml .  Be sure to have a backup and edit at your own peril.
    But remember manual changes will likely be clobbered if any GUI changes are subsequently made prior to a restart. 
    If I recall rebooting immediately after making manual changes works to get the new config loaded without clobbering the manual changes. 
    Perhaps someone knows a programmatic way to reload the config without having to reboot.


  • Banned

    @secad000:

    I dont used DHCP. Can you please give me steps on how to edit the config and the location of it.

    Let me say this again:

    @doktornotor:

    Use the ShellCmd package

    It will run your command on every reboot. Really.