LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 08-29-2014, 03:34 AM   #1
jessetaylor84
Member
 
Registered: Jan 2014
Location: Olympia, WA
Distribution: Debian / Tails
Posts: 47

Rep: Reputation: 10
How to set up Debian system to use static IP assigned by my ISP


I just purchased a block of static IP addresses from CenturyLink, and I am trying to configure my Debian web server to use one of them.

My web server sits behind a broadband modem/router (along with several other personal computers that share the network), and I want the webserver to be reachable by a static IP from hosts on remote networks.

I was assigned the IP block 64.222.251.104 - 64.222.251.111

Reserve network is 64.222.251.104
Reserve gateway is 64.222.251.110
Reserve broadcast is 64.222.251.111

So the usable static IPs that I have for my web server are 64.222.251.105 - 64.222.251.109

If I wanted to run my web server on 64.222.251.105 (I want www.mydomain.org to point here), where would I set this up, given the information above? I found some guides that suggested editing /etc/network/interfaces, but many of them gave conflicting advice, and none of the ones I tried worked ... Is this even the right config file to be editing? Do I have to do anything with my Apache configuration files (or any other configuration files) too?

Thanks!

Last edited by jessetaylor84; 08-29-2014 at 03:46 AM.
 
Old 08-29-2014, 03:50 AM   #2
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
That broadband router/modem thing need some elaboration to make sure it dont block anything.

Besides that /etc/network/interfaces is your friend. As well as man interfaces. Generelly you would add the wanted ip 64.222.251.105 to the nic attached to the router. Use the gateway of 64.222.251.104. And you should be good to go.

As per default install of apache on debian you would not need anything more to configure on. If you have some virtual domains going you might need to adjust them. What you definitely have to touch is your /etc/hosts file. You want to have the ip 64.222.251.105 with the proper name in it.

Just break down thing in steps. First make sure your server is reachable from the outside through ping or similar. Then get your webserver up and running. Then turn to the virtual domains of apache.
 
1 members found this post helpful.
Old 08-31-2014, 04:52 PM   #3
jessetaylor84
Member
 
Registered: Jan 2014
Location: Olympia, WA
Distribution: Debian / Tails
Posts: 47

Original Poster
Rep: Reputation: 10
Thanks for your response.

So the default /etc/network/interfaces on my server contained only the following:

Code:
# The loopback network interface
auto lo
iface lo inet loopback
I added the following to it:

Code:
#Set up eth0 to use static IP
iface eth0 inet static
    address 64.226.251.105
    netmask 255.255.255.0
    network 64.226.251.104
    broadcast 64.226.251.111
    gateway 64.226.251.110
And then did /etc/init.d/networking restart, which did not throw any error messages and reported success.

However, when I run ifconfig, it shows the following:

Code:
root@debian:/etc/network# ifconfig -a
eth0      Link encap:Ethernet  HWaddr 00:11:11:7d:86:5c  
          inet addr:192.168.0.18  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::211:11ff:fe7d:865c/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:62156 errors:0 dropped:0 overruns:0 frame:0
          TX packets:38967 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:64061370 (61.0 MiB)  TX bytes:4880863 (4.6 MiB)
That is, for some reason, changing /etc/network/interfaces does not seem to be actually affecting eth0 - it's still using DHCP to get an address.

Do you have any suggestions for what might be preventing this from taking effect?

Thanks!
 
Old 08-31-2014, 06:36 PM   #4
jessetaylor84
Member
 
Registered: Jan 2014
Location: Olympia, WA
Distribution: Debian / Tails
Posts: 47

Original Poster
Rep: Reputation: 10
I figured it out. The problem was that network-manager was overriding it. I just removed/purged network-manager and did ifdown/ifup eth0 it works fine now.
 
Old 09-02-2014, 01:15 AM   #5
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
Nice you got it figured.

service networking restart is not really safe to use. Though i dont know why this is. There also used to be a warning that using it might lead to unintented behaviour.
What I do most of the time and also work most of the time is to stop and then start the networking and not restart it in one go. Else you just would have to set all the things by hand or just reboot.

Just a tiny suggestion. Dig in to the ip command. Its the succesor of the ifconfig tool and I find it more powerful and easier to use once accomodated to it
 
  


Reply

Tags
debian, static ip



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
set static dns server in debian jsmarshall85 Linux - Networking 5 09-07-2009 06:44 AM
Set IP address to static from DHCP assigned address jborn Linux - Networking 4 02-02-2007 08:38 PM
Debian eth pulling DHCP even after Static is assigned pork_salad Linux - Networking 2 03-30-2006 06:46 PM
Cannot ping local system when pinging system is set for static IP SkipHuffman Linux - Networking 4 08-22-2005 11:56 AM
FC2 Overriding static if in favor of dhcp system set for static pkraus109 Linux - Networking 8 09-21-2004 11:13 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:50 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration