LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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
 
LinkBack Search this Thread
Old 03-21-2013, 03:47 PM   #1
peridian
Member
 
Registered: Jan 2010
Posts: 54

Rep: Reputation: 16
ifcfg setup for non 192.x IP address range


Hi,

I've got a Linux machine with two network ports. One is already configured to run on the 192.168.* network, but I am trying to configure the second one to act as the gateway for a different IP range.

When I run ifconfig, it shows the network interface is up and running, but it doesn't report its static IP address. Is this normal for a gateway interface?

Code:
DEVICE=eth1
TYPE=Ethernet
UUID=<some uuid>
BOOTPROTO=static
HWADDR=<some MAC>
IPADDR=196.100.1.254
PREFIX=24
GATEWAY=196.100.1.254
BROADCAST=196.100.1.255
NETMASK=255.255.255.0
NETWORK=196.100.1.0
DNS1=196.100.1.254
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="Internal Test Network"
Regards,
Rob.
 
Old 03-21-2013, 08:28 PM   #2
KinnowGrower
Member
 
Registered: May 2008
Location: Toronto
Distribution: Centos && Debian
Posts: 341

Rep: Reputation: 34
Code:
IPADDR=196.100.1.254
It is not a private IP range. Did you or your company own this IP range.? BOOTPROTO= can be either none, bootp, dhcp
 
Old 03-22-2013, 02:46 PM   #3
peridian
Member
 
Registered: Jan 2010
Posts: 54

Original Poster
Rep: Reputation: 16
Hmm, okay perhaps my networking understanding is not what I thought.

I thought any IP address starting between 192 - 223 was acceptable for Class C networks. I tried changing the IP addresses so it was based on 192.168.100.*, thinking that it still uses the same 192.168.* range that is reserved for private networks. This also doesn't seem to work.

I tried using the calculator here: http://www.csgnetwork.com/ipinfocalc.html
That gave me the values I used in the script.

I cannot believe that all private networks are restricted to being in the 192.168.0.* or 192.168.1.* ranges. Surely I must be able to pick a totally different IP range for an entirely internal network.

Regards,
Rob.
 
Old 03-22-2013, 07:07 PM   #4
KinnowGrower
Member
 
Registered: May 2008
Location: Toronto
Distribution: Centos && Debian
Posts: 341

Rep: Reputation: 34
Quote:
I cannot believe that all private networks are restricted to being in the 192.168.0.* or 192.168.1.* ranges.
Here is the Link http://en.wikipedia.org/wiki/Private_network explaining private IP address ranges.Keep note of netmask that is very important.

Quote:
One is already configured to run on the 192.168.* network
You did not show completely the network range you are using. You can use e,g 192.168.10.0/24 for one side and 192.168.20.0/24 for other side. Or you can pick 10.20.20.0/24 for one side and 10.30.30.0/24 for other side. Simple is that.
 
Old 03-22-2013, 07:09 PM   #5
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
There are other private network ranges. 10.x.x.x provides a class A range. Often a subnet is used, with the second or second & third octet chosen at random. This is to prevent collisions in the future if your company merges or has another site. Then it is easy to route VPN traffic, and you won't need to change all of the IP addresses on one of the sites.

Here are the private ranges listed in the rfc1918 document:
Quote:
Originally Posted by http://tools.ietf.org/html/rfc1918
10.0.0.0 - 10.255.255.255 (10/8 prefix)
172.16.0.0 - 172.31.255.255 (172.16/12 prefix)
192.168.0.0 - 192.168.255.255 (192.168/16 prefix)
You will need to enable IP forwarding. Either through your networking configuration applet, or by editing /etc/sysctl.conf:
net.ipv4.ip_forward = 1

To do this immediately (ie before rebooting), as root run: echo 1 >/proc/sys/net/ipv4/ip_forward
An alternative command is &quot;sudo /sbin/sysctl net.ipv4.ip_forward=1&quot;


Also check your routes with &quot;ip route show&quot;.

Last edited by jschiwal; 03-22-2013 at 07:14 PM.
 
Old 03-22-2013, 07:10 PM   #6
KinnowGrower
Member
 
Registered: May 2008
Location: Toronto
Distribution: Centos && Debian
Posts: 341

Rep: Reputation: 34
Quote:
Originally Posted by peridian View Post
This also doesn't seem to work.
Also show what you did and that is not working
 
Old 03-23-2013, 10:19 AM   #7
peridian
Member
 
Registered: Jan 2010
Posts: 54

Original Poster
Rep: Reputation: 16
Thanks for all the feedback guys. I decided to simplify this down, and I'm starting to think this is probably a really simple oversight.

Full config files and ifconfig output below. The fact that it registers an IPv6 address makes me think there's not a hardware issue. I have also set the net.ipv4.ip_forward = 1 entry and restarted the machine.

I also started to wonder if perhaps my iptables is too aggressive and was blocking itself, so I have attached below.

Code:
/etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0
TYPE=Ethernet
UUID=<some uuid>
ONBOOT=no
BOOTPROTO=static
HWADDR=<some mac>
IPADDR=192.168.2.254
PREFIX=24
GATEWAY=192.168.2.254
BROADCAST=192.168.2.255
NETMASK=255.255.255.0
NETWORK=192.168.2.0
DNS1=192.168.2.254
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="Internal Test Network"


/etc/sysconfig/network-scripts/ifcfg-eth1

DEVICE=eth1
TYPE=Ethernet
UUID=<some uuid>
ONBOOT=yes
BOOTPROTO=static
HWADDR=<some mac>
IPADDR=192.168.1.100
PREFIX=24
GATEWAY=192.168.1.254
BROADCAST=192.168.1.255
NETMASK=255.255.255.0
NETWORK=192.168.1.0
DNS1=192.168.1.254
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="Main Office LAN"


/etc/sysconfig/iptables

*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT DROP [0:0]
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A OUTPUT -m state --state NEW -m udp -p udp --dport 53 -s 192.168.1.100 -d 192.168.1.254 -j ACCEPT
-A OUTPUT -m state --state NEW -m tcp -p tcp --dport 53 -s 192.168.1.100 -d 192.168.1.254 -j ACCEPT
-A OUTPUT -m state --state NEW -m tcp -p tcp --dport 80 -s 192.168.1.100 -j ACCEPT
-A OUTPUT -m state --state NEW -m tcp -p tcp --dport 443 -s 192.168.1.100 -j ACCEPT
COMMIT


/etc/sysconfig/network

NETWORKING=yes
HOSTNAME=test1.internal
GATEWAY=192.168.1.254


/etc/resolv.conf

nameserver=192.168.1.254



 

iconfig output

eth0           Link encap:Ethernet   HWaddr <some mac>
               inet6 addr: fe80::6670:2ff:fe11:ee91/64 Scope:Link
               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
               RX packets:0 errors:0 dropped:0 overruns:0 frame:0
               TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
               collisions:0 txqueuelen:1000
               RX bytes:0 (0.0 b)  TX bytes:468 (468.0 b)

eth1           Link encap:Ethernet   HWaddr <some mac>
               inet addr:192.168.1.100  Bcast:192.168.1.255  Mask:255.255.255.0
               inet6 addr: fe80::be5f:f4ff:fe12:5b4d/64 Scope:Link
               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
               RX packets:489 errors:0 dropped:0 overruns:0 frame:0
               TX packets:11 errors:0 dropped:0 overruns:0 carrier:0
               collisions:0 txqueuelen:1000
               RX bytes:29850 (29.1 KiB)  TX bytes:678 (678.0 b)

lo             Link encap:Local Loopback
               inet addr:127.0.0.1  Mask:255.0.0.0
               inet6 addr: ::1/128 Scope:Host
               UP LOOPBACK RUNNING  MTU:16436  Metric:1
               RX packets:0 errors:0 dropped:0 overruns:0 frame:0
               TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
               collisions:0 txqueuelen:0
               RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
Any help would be appreciated.

Regards,
Rob.
 
Old 03-23-2013, 07:46 PM   #8
KinnowGrower
Member
 
Registered: May 2008
Location: Toronto
Distribution: Centos && Debian
Posts: 341

Rep: Reputation: 34
Quote:
Originally Posted by peridian View Post
[CODE]
/etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0
TYPE=Ethernet
UUID=<some uuid>
ONBOOT=no
BOOTPROTO=static
HWADDR=<some mac>
IPADDR=192.168.2.254
PREFIX=24
GATEWAY=192.168.2.254
BROADCAST=192.168.2.255
NETMASK=255.255.255.0
NETWORK=192.168.2.0
DNS1=192.168.2.254
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="Internal Test Network"
parameter ONBOOT=no means interface wont up at boot time. So change it as shown below.

Code:
ONBOOT=yes
 
Old 03-23-2013, 08:08 PM   #9
blue_print
Member
 
Registered: May 2010
Location: In world
Distribution: RHEL, CentOS, Ubuntu
Posts: 275
Blog Entries: 3

Rep: Reputation: 49
This seems to be wrong as IPADDR and GATEWAY are holding the same IP.

Quote:
IPADDR=192.168.2.254
PREFIX=24
GATEWAY=192.168.2.254
Please change the IPADDR to a different one and restarting network service.
 
Old 03-24-2013, 04:04 PM   #10
peridian
Member
 
Registered: Jan 2010
Posts: 54

Original Poster
Rep: Reputation: 16
Damn, blast and doh!

Okay, this is all a non-issue.

Quote:
parameter ONBOOT=no means interface wont up at boot time.
I was aware of that, and was using ifconfig eth0 up command to turn it on manually in case of issues. What I didn't know was what I just found in the below link:

http://www.linuxhomenetworking.com/w...g#.UU9nh-nx7AN

Quote:
In this example, eth0 has no IP address because this box is using wireless interface wlan0 as its main NIC.
Essentially, ifconfig will only display the inet4 addresses on NICs that start when the network starts. I've just experimented with enabling/disabling eth0/1 in turn, and using the ifconfig <nic> up command on the disabled one. Each time, only the NIC with ONBOOT=yes will display its inet4 address.

The problem is not IP address ranges, and I'm not going as mad as I thought...

Thanks for all the advice guys.

Rob.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
assigning range of ip address not working- ifcfg-eth0-range0 anjan_rs@hotmail.com Red Hat 4 09-08-2011 01:36 AM
Error!! str2addr:Address 35 outside range of address field length 1 !!! MounaRM Linux - Networking 1 05-12-2011 11:32 PM
[SOLVED] change ip address to 192.168.0.x? windstory Linux - Newbie 11 08-20-2009 07:49 AM
static ifcfg-eth0 config but no IP-address jonaskellens Linux - Newbie 2 06-19-2009 03:19 PM
ifcfg-eth-id MAC address cloning RDR Suse/Novell 2 03-07-2006 09:30 AM


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

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration