LinHES Forums
http://forum.linhes.org/

Change from DHCP to static?
http://forum.linhes.org/viewtopic.php?f=11&t=17123
Page 1 of 1

Author:  aravenel [ Sun Oct 28, 2007 4:02 pm ]
Post subject:  Change from DHCP to static?

Hi all... I just upgraded to R5F27, and when I was going through the setup, accidentally chose to use DHCP broadcast instead of giving it a static IP address. It still works, but just to ensure that the IP address doesn't change, I'd like to assign it one. Is there any way to change it away from DHCP broadcast without rebuilding the machine? Can I rerun that script?

Thanks!

Author:  slowtolearn [ Sun Oct 28, 2007 4:46 pm ]
Post subject:  Re: Change from DHCP to static?

aravenel wrote:
Hi all... I just upgraded to R5F27, and when I was going through the setup, accidentally chose to use DHCP broadcast instead of giving it a static IP address. It still works, but just to ensure that the IP address doesn't change, I'd like to assign it one. Is there any way to change it away from DHCP broadcast without rebuilding the machine? Can I rerun that script?

Thanks!
Try running netcardconfig as root...

Author:  tjc [ Sun Oct 28, 2007 5:56 pm ]
Post subject: 

You may need to use the --force option to get it to reconfigure the card. E.g.
Code:
netcardconfig --force

Author:  manicmike [ Sun Oct 28, 2007 6:04 pm ]
Post subject:  Re: Change from DHCP to static?

aravenel wrote:
Hi all... I just upgraded to R5F27, and when I was going through the setup, accidentally chose to use DHCP broadcast instead of giving it a static IP address.


Why don't you 'fix' the ip address to your myth box using the router config? This way you get the exact same ip address regardless of whether you upgrade, rebuild or whatever. It ties the ip address to the MAC (hardware) address of your network card. No static config required, and dhcp is really a lot easier.

Mike

Author:  tjc [ Mon Oct 29, 2007 8:34 pm ]
Post subject: 

His router may not be able to do that. I know that mine (a relatively old Linksys model) won't for example, and frankly I'm more than comfortable enough with networking configuration to not make it worth replacing.

Author:  Big boy stan [ Tue Jun 10, 2008 8:50 am ]
Post subject: 

My new router seems to have a problem remembering static IP rules. It is an Actiontec and the problem seems well documented on the web but no solutions so I thought to set it up with netcardconfig as descibed above.

I pointed all the questiones (except for the desired IP adress) back to the router but could not get any communication inside (or outside) on the network.

Is there a way to use DHCP and then lookup the IPs that are being used (gateway, DNS server, etc). I could then use netcardconfig with the same info but with my static IP.

Thanks.

Author:  jzigmyth [ Tue Jun 10, 2008 9:34 am ]
Post subject: 

Usually the gateway and DNS servers can point to the router address, but the netmask should usually be set to 255.255.255.0 for linksys and the like. The broadcast address is the same as the router address except the last group should be 255. Make sure you have the correct router address. Knoppmyth seems to suggest something ending in 254, but most home routers are preconfigured to end in 1.

When picking a static IP make sure you pick one that isn't in the range of dynamic ones that the router will be handing out. Linksys defaults to dynamic IPs starting at 100 and above, so if you have a linksys, pick a static ip ending in below 100 (but not the same as the router).

for instance:
192.168.0.33 Static IP address of Myth Box (user selected)
192.168.0.1 gateway (determined by router setup)
192.168.0.255 broadcast address (always ends in 255)
255.255.255.0 netmask (same for all class C networks)
192.168.0.1 DNS server (usually same as router, but can be set to other DNS servers)


another for instance:
192.168.1.22 IP address of Myth Box
192.168.1.1 gateway (router)
192.168.0.255 broadcast address
255.255.255.0 netmask
192.168.1.1 DNS server

Author:  Big boy stan [ Tue Jun 10, 2008 10:07 am ]
Post subject: 

Thanks jzig, I hadn't thought about the overlap between the ip address that i was picking and the ones in the DHCP pool. I will try to have the router give me one outside the pool and see it that sticks. Otherwise I will try the netcardconfig again with your suggestions.

Author:  cliffsjunk [ Tue Jun 10, 2008 3:44 pm ]
Post subject: 

I always answer yes to "Use DHCP" during setup, but immediately change
my /etc/network/interfaces to make it static. It looks like this when I am done:
Code:
# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)

# The loopback interface
# automatically added when upgrading
auto lo
iface lo inet loopback

auto eth0
#iface eth0 inet dhcp
iface eth0 inet static
        address 192.168.0.252
        netmask 255.255.255.0
        broadcast 192.168.0.255
        network 192.168.0.0
        metric 1
        gateway 192.168.0.1


I changed the above to show a standard 24 bit netmask as I actually use
a 23 bit netmask.

Didn't even know whether or not there was an option besides DHCP in the setup.

I prefer static addresses as some boxes don't remember their leases like
they should and my router/firewall is an old 200mhz pentium that takes
longer to come up after power fail than my other boxes.

Cliff

Author:  mjl [ Tue Jun 10, 2008 7:07 pm ]
Post subject: 

Hi,

As much as I diddle with my KM boxes I gave up on static quite some time ago. I may have one box that falls into the "I forget mode" and will give it a static.

However that leaves the issue of what the heck is the address of box x,y or z?

Again being lazy, I cheat and add a couple items that are easily put back on an upgrade or add on an install.
First I tweak Cecil's ver.sh script:
nano -w /usr/local/bin/ver.sh
Code:
#!/bin/bash
killall osd_cat
lsmod |grep "ivtvfb "|cut -b1-6 >/tmp/tv
if [ "$(cat /tmp/tv)" = "ivtvfb" ]; then
fontsize="25"
fontcolor="lightyellow"
else
fontsize="34"
fontcolor="yellow"
fi
export FONT="-adobe-helvetica-bold-*-*-*-$fontsize-*-*-*-*-*-*-*"
export DISPLAY=:0
cat /etc/KnoppMyth-version > /tmp/ver
date >> /tmp/ver
/sbin/ifconfig |grep eth |cut -b1-4 >/tmp/net
/sbin/ifconfig "$(cat /tmp/net)" | sed -n -e '/inet addr:\([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*\).*/s//\1/p' | cut -c11-26 >/tmp/ip
echo -n  "IP $(cat /tmp/ip) _._ MythTV  - " >> /tmp/ver
cat /etc/hostname >> /tmp/ver
cat /etc/mythtv/version >> /tmp/ver
cat /home/mythtv/lbu.txt>>/tmp/ver
cat /tmp/ver | osd_cat --l=8 --delay=12 --font=$FONT --shadow=2 --color=$fontcolor --pos=middle --align=centre&


Then I mess with the backup script a little, since there was some space left between the #!/bin/bash & the #--- line, I add:
nano -w /usr/local/bin/mythbackup
#!/bin/bash
echo -n "Backed up ">/home/mythtv/lbu.txt
date >>/home/mythtv/lbu.txt

#----------------------------------------------------------------------------

and now when you run backup, you have a stamp of when it was started. so when you select the version in the menu...... but that was unhandy so:
nano -w /etc/X11/fluxbox/keys
Mod1 v :ExecCommand ver.sh

Restart x server and when you Hit alt + v and all the important stuff is handy :)

Gotchas:
More than one nic card, may have to manually set script to be card needed :(
Extra stuff just adjusts display for tv out on 350 card.

Mike
Edit once, Sorry, noticed a copy error, too busy writing and not paying attention to detail :oops:

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/