Announcement

Collapse
No announcement yet.

Experimenting with static ip addressing (CRASH or BLOW-UP possible?)

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Experimenting with static ip addressing (CRASH or BLOW-UP possible?)

    "AS ALWAYS, USING INFO FROM MY POST COULD CRASH OR BLOW-UP YOUR MACHINE"

    This is probably an ugly hack but,

    My original goal <SOLVED> is to set my wired network to access the internet
    via my other laptop, which is able to get a strong wireless signal. (It's
    only just across the room 'call me lazy'). I was able to get connected by
    editing /etc/network/interfaces as follows:

    username@cpu:~$ cat /etc/network/interfaces

    auto lo
    iface lo inet loopback


    #auto wlan0
    iface wlan0 inet static
    wireless-essid #######
    address 192.168.1.40
    network 192.168.1.0
    netmask 255.255.255.0
    broadcast 192.168.1.255
    nameservers ##6.##9.1##.# ##6.#.##.##1
    gateway 192.168.1.1


    auto eth0
    iface eth0 inet static
    address 192.168.7.6
    network 192.168.7.0
    netmask 255.255.255.0
    broadcast 192.168.7.255
    nameservers ##6.##9.1##.# ##6.#.##.##1
    gateway 192.168.7.4

    username@cpu:~$

    Obviously my other laptop (running XP) has it's wireless as 192.168.1.30
    and set to share it's internet and it's wired ethernet address is set to
    192.168.7.4 .

    This didn't quite work. The nameserver lines didn't take and I'd have to
    open System->Administration->Network, supply my password and type in the
    dns server addresses on each reboot. I also found I could edit them into
    /etc/resolv.conf (I ignored the thing about DO NOT EDIT). But, on reboot d
    system clears it's nameserver's cause someone determined, that was best?
    It might be, too. I decided to try a few other angles. (left in below)

    I played with:

    username@cpu:~$ cat ~/Desktop/set-dns
    #!/bin/sh
    #
    # ORIGINAL WAS SCRIPT TO SET STATIC IP'S BUT NOW IT'S SCRIPT TO SET DNS
    #
    # THE HASHED OUT DIDN'T WORK FOR ME I EDITED /etc/network/interfaces
    # TO SPECIFY STATIC IP'S
    #
    # SCRIPT TO MANUALLY SET ETH0 & WLAN0 ADDRESSES
    #sudo ifconfig eth0 down
    #sudo ifconfig eth0 192.168.7.6 netmask 255.255.255.0
    #sudo route add default gw 192.168.7.4 eth0
    #sudo ifconfig eth0 up
    #sudo ifconfig wlan0 down
    #sudo ifconfig wlan0 192.168.1.40 netmask 255.255.255.0
    #sudo route add default gw 192.168.1.1 wlan0
    #sudo if config wlan0 up
    #
    # THE FOLLOWING COPIES MY EDITED VERSION OF /etc/resolv.conf
    # /my.resolv.conf to /etc/resolv.conf
    # (IF IT WORKS?)
    # 1ST TRY IT DIDN'T. JUST COPYING THE FILE CREATED A LINK TO ORIGINAL INSTEAD)

    # COMMENTED OUT:
    #sudo cp -dpf /home/username/my.resolv.conf /etc/resolvconf/run/resolv.conf

    # IN ATTEMPT TO MAKE THIS WORK I OPENED /etc/resolvconf/run/resolv.conf
    # WITH A FILE EDITOR, I USED 'kdesudo kate' THEN, SELECT ALL, COPY, CREATE NEW,
    # PASTE, CLOSE THE /etc/resolvconf/run/resolv.conf THEN SAVED THE NEW FILE AS
    # /home/username/my-resolv.conf-edited . I THEN VERIFIED IT'S PROPERTIES,
    # IN MY CASE I USED 'kdesudo konqueror' TO MAKE SURE THE PROPERTIES MATCHED
    # THE ONES FOR /etc/resolvconf/run/resolv.conf . MY NEW cp LINE IS:

    sudo cp -dpf /home/username/my-resolv.conf-edited /etc/resolvconf/run/resolv.conf

    # (I HOPE THIS WORKS?)

    username@cpu:~$

    My edited copy of /etc/resolvconf/run/resolv.conf

    username@cpu:~$ cat my-resolv.conf-edited
    # Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
    # DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
    nameserver ##6.##9.1##.#
    nameserver ##6.#.##.##1
    username@cpu:~$

    So now after reboot I have to do a konsole (in my kubuntu-studio blend it's
    terminal) and do...

    sh ~/set-dns

    ...and it works.

    I followed instructions, I found at...

    http://sysbytes.wordpress.com/2009/1...n-ubuntu-9-04/

    ...I'll try the copy to /etc/init.d way (and the rest of it's steps).

    username@cpu:~$ cd /etc/init.d
    username@cpu:/etc/init.d$ sudo cp -dp ~/Desktop/set-dns .
    username@cpu:/etc/init.d$ ls set*
    set-dns
    username@cpu:/etc/init.d$

    Didn't have to run 'chmod +x set-dns' as I'd already made it executable earlier.

    username@cpu:/etc/init.d$ sudo update-rc.d set-dns defaults
    update-rc.d: warning: /etc/init.d/set-dns missing LSB information
    update-rc.d: see <http://wiki.debian.org/LSBInitScripts>
    Adding system startup for /etc/init.d/set-dns ...
    /etc/rc0.d/K20set-dns -> ../init.d/set-dns
    /etc/rc1.d/K20set-dns -> ../init.d/set-dns
    /etc/rc6.d/K20set-dns -> ../init.d/set-dns
    /etc/rc2.d/S20set-dns -> ../init.d/set-dns
    /etc/rc3.d/S20set-dns -> ../init.d/set-dns
    /etc/rc4.d/S20set-dns -> ../init.d/set-dns
    /etc/rc5.d/S20set-dns -> ../init.d/set-dns
    username@cpu:/etc/init.d$

    Because of warning and since I did this while logged in, I also followed and added
    this startup script via gui. I hope the system doesn't break, and that it works.
    Time for reboot. (fingers crossed)

    Rebooted, and yes, it works. I'll have to edit /etc/network/interfaces if ever I
    change my network requirements. Or have to access internet via Laundrymat's wifi or
    something.

    ;^)

    Sorry for the unintended possible interpretation.
    (I don't care much for the upturned nose, but small letter v looks worse)

    [Edit]
    This link is to a youtube video showing how to manually configure ip address. (It must be using HH, and looks
    to be on a server.)
    http://www.youtube.com/watch?v=_tRcW4a2K3w
    [Edit end]
Working...
X