making ifconfig permanent?
Results 1 to 5 of 5

Thread: making ifconfig permanent?

  1. #1
    Priapistic Monk KorpDeath's Avatar
    Join Date
    Dec 2001
    Posts
    2,628

    making ifconfig permanent?

    Here's a really easy question...
    Which file do I need to edit to enable multiple IP addresses on a FreeBSD?

    I know this is simple but I can't find this tidbit anywhere.

    When i do an ifconfig and add the IP's it works fine. I reboot and *poof* they aren't there anymore... Any help would be much appreciated.

    Thank you all in advance.
    Mankind have a great aversion to intellectual labor; but even supposing knowledge to be easily attainable, more people would be content to be ignorant than would take even a little trouble to acquire it.
    - Samuel Johnson

  2. #2
    Senior Member
    Join Date
    Jan 2003
    Posts
    3,914
    Hey Hey,

    /etc/rc.conf

    ifconfig_whatever="config"
    ifconfig_whatever2="config2"

    Peace

    HT
    IT Blog: .:Computer Defense:.
    PnCHd (Pronounced Pinched): Acronym - Point 'n Click Hacked. As in: "That website was pinched" or "The skiddie pinched my computer because I forgot to patch".

  3. #3
    AO übergeek phishphreek's Avatar
    Join Date
    Jan 2002
    Posts
    4,325
    I pm'd this to you... but it'd be good for everyone.

    http://freebsd.rogness.net/
    Quitmzilla is a firefox extension that gives you stats on how long you have quit smoking, how much money you\'ve saved, how much you haven\'t smoked and recent milestones. Very helpful for people who quit smoking and used to smoke at their computers... Helps out with the urges.

  4. #4
    Priapistic Monk KorpDeath's Avatar
    Join Date
    Dec 2001
    Posts
    2,628
    Alright, so adding virtual addresses is as easy a I thought (when you know what to do). As with every other part of *nix, it's all about which file to edit and which way to edit it.

    Here's the standard exapmle rc.conf:
    -- sysinstall generated deltas -- # Fri Jun 13 10:48:08 2003
    # Created: Fri Jun 13 10:48:08 2003
    # Enable network daemons for user convenience.
    # Please make all changes to this file, not to /etc/defaults/rc.conf.
    # This file now contains just the overrides from /etc/defaults/rc.conf.
    defaultrouter="10.1.10.1"
    hostname="silicon.xxxxxxx.com"
    ifconfig_xl0="inet 10.1.10.250 netmask 255.255.255.0"
    kern_securelevel_enable="NO"
    linux_enable="YES"
    moused_enable="YES"
    nfs_reserved_port_only="YES"
    sendmail_enable="YES"
    sshd_enable="YES"
    usbd_enable="YES"
    # -- sysinstall generated deltas -- # Mon Jun 30 17:03:06 2003
    saver="fire"

    And here's the change I made:
    -- sysinstall generated deltas -- # Fri Jun 13 10:48:08 2003
    # Created: Fri Jun 13 10:48:08 2003
    # Enable network daemons for user convenience.
    # Please make all changes to this file, not to /etc/defaults/rc.conf.
    # This file now contains just the overrides from /etc/defaults/rc.conf.
    defaultrouter="10.1.10.1"
    hostname="silicon.xxxxxxx.com"
    ifconfig_xl0="inet 10.1.10.250 netmask 255.255.255.0"
    ifconfig xl0 add 10.1.10.251 netmask 255.255.255.255
    kern_securelevel_enable="NO"
    linux_enable="YES"
    moused_enable="YES"
    nfs_reserved_port_only="YES"
    sendmail_enable="YES"
    sshd_enable="YES"
    usbd_enable="YES"
    # -- sysinstall generated deltas -- # Mon Jun 30 17:03:06 2003
    saver="fire"

    Now make sure when you are using virtual hosts that you make the subnet mask /32 or 255.255.255.255. Otherwise it won't work.

    It's so simple and yet I've found no documentation to answer this specific question.

    And by the way thanks guys. I can always count on AO to help me out in a tight spot.

    Hope this helps somebody out.(besides me, of course.)
    Mankind have a great aversion to intellectual labor; but even supposing knowledge to be easily attainable, more people would be content to be ignorant than would take even a little trouble to acquire it.
    - Samuel Johnson

  5. #5
    Hi mom!
    Join Date
    Aug 2001
    Posts
    1,103
    Unrelated, but helpful:

    Code:
    ntpdate_enable="YES"    ## Atomclock-synchronisation
    ntpdate_flags="ntp0.nl.net ntp.planet.nl ntp.tue.nl ntp.xs4all.nl ntp.utwente.nl"
    xntpd_enable="YES"
    The lines above add timesynchronisation to your server. Change the .nl servers for something which is closer to you.

    Below are some pointers on how to do dhcp and nat. See man for more info, but it should get you started (took me some time to figure it out, might save you some time :P

    Code:
    network_interfaces="fxp0 fxp1 lo0"                      ## interfaces
    ifconfig_lo0="inet 127.0.0.1"                           ##   localhost-interface
    ifconfig_fxp0="inet 192.168.0.1  netmask 255.255.255.0" ##   LAN-interface
    ifconfig_fxp1="DHCP"                                    ##   interface towards modem
    dhcp_program="/sbin/dhclient"
    dhcp_flags=""
    
    gateway_enable="YES"            ## running NAT without being a gateway isn't really useful.
    natd_program="/sbin/natd"
    natd_enable="YES"               ## Yes, lets enable it.
    natd_interface="fxp1"
    natd_flags="-f /etc/natd.conf"  ## Use this file for other options (f.e. PORTFORWARDING)
    finally, here's the /etc/natd.conf I use to forward from one computer behind de gateway to the big bad world outside:

    Code:
    dynamic yes
    use_sockets yes
    same_ports yes
    redirect_port tcp 192.168.0.2:5900 32323  ## inside IP
    redirect_port tcp xx.xx.xx.xx:32323 5900  ## outside IP
    I wish to express my gratitude to the people of Italy. Thank you for inventing pizza.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •