LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-31-2014, 09:54 AM   #1
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,697

Rep: Reputation: 48
Files to change IP, mask, and default gateway, & on a vsftp server


I know in /etc/sysconfig/network-scripts/ for the ifcfg-eth0 you have to change the IP address, mask, and default gateway in that file for the actual interface itself.
Aren't there other files that may contain the mask and default gateway that I should check to see if they need to be updated as well?

Also, this is a vsftpd server, not sure if its config contains any network info that needs to be updated either?
 
Old 01-31-2014, 10:51 AM   #2
myatthu
Member
 
Registered: Jan 2014
Distribution: CentOS, Fedora, Ubuntu
Posts: 108

Rep: Reputation: 18
Yes you right if you only have one network card.
If you have more than one card, you need to find out which card is connected.
You can find out with ethtool command if you don't have physical access to server.
For vsftp server, generally it will listen on all the interfaces.
Find out which interfaces with
netstat -anp | grep vsftp
 
Old 01-31-2014, 11:30 AM   #3
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,697

Original Poster
Rep: Reputation: 48
Thanks, i'll check it out. But isn't there another file somewhere (not one of the interface files but a general file) that might have at least the default gateway in it? I keep thinking there is for some reason.
 
Old 01-31-2014, 11:41 AM   #4
myatthu
Member
 
Registered: Jan 2014
Distribution: CentOS, Fedora, Ubuntu
Posts: 108

Rep: Reputation: 18
Although I am still confuse what you try to ask, for default gateway(route) at RedHat. You can configure two ways.
1. You can put GATEWAY=x.x.x.x at one of the /etc/sysconfig/network-scripts/if-cfgX
2. You can put GATEWAY=x.x.x.x at /etc/sysconfig/network
 
Old 01-31-2014, 12:00 PM   #5
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,697

Original Poster
Rep: Reputation: 48
Ah, in /etc/sysconfig/network, that was the file I was referring to but couldn't remember what it was. Thanks myatthu.
 
Old 01-31-2014, 12:02 PM   #6
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,697

Original Poster
Rep: Reputation: 48
when I look in my ifcfg-eth0, I don't have a gateway=x.x.x.x, so does that mean it's using the gateway that's in /etc/sysconfig/network? or could it be called something else in ifcfg-eth0, like network=x.x.x.x?
 
Old 01-31-2014, 12:06 PM   #7
myatthu
Member
 
Registered: Jan 2014
Distribution: CentOS, Fedora, Ubuntu
Posts: 108

Rep: Reputation: 18
If we are talking about default gateway or route, it should be GATEWAY. Not NETWORK
yes ifcfg is precedence then /etc/sysconfig/network. What do you see at that file?
What is your route output?

Code:
netstat -nr
 
Old 01-31-2014, 12:26 PM   #8
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,697

Original Poster
Rep: Reputation: 48
I'm kinda confused, as those are both currently set to different IPs, so wasn't sure. Here's what's currently on my server, with the non-important numbers changed slightly. I've been given a new IP, mask, and default gateway so I can move my server, but I've never changed all that before so want to make sure I know all the spots I need to change.


more ifcfg-eth0
DEVICE=eth0
BOOTPROTO=static
BROADCAST=1.2.2.127
IPADDR=1.2.2.80
NETMASK=255.255.255.192
NETWORK=1.2.2.64
ONBOOT=yes

more network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=MyHostName
GATEWAY=1.2.2.65

netstat -nr
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
1.2.2.64 0.0.0.0 255.255.255.192 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
0.0.0.0 1.2.2.65 0.0.0.0 UG 0 0 0 eth0
 
Old 01-31-2014, 12:40 PM   #9
myatthu
Member
 
Registered: Jan 2014
Distribution: CentOS, Fedora, Ubuntu
Posts: 108

Rep: Reputation: 18
Based on your feedback, nothing is strange

Your IP is 1.2.2.80/26
So your network will be 1.2.2.64 which you configure at ifcfg-eth0 as below [PASS]
Code:
NETWORK=1.2.2.64
Your route output as below
Code:
1.2.2.64 0.0.0.0 255.255.255.192 U 0 0 0 eth0
You use first IP as gateway IP. It is valid (but that depend on your network either first or last IP. What is your router interface IP) as long as correct [PASS]
Your route output is correct too
Code:
0.0.0.0 1.2.2.65 0.0.0.0 UG 0 0 0 eth0
Looks everything fine.
 
Old 01-31-2014, 02:07 PM   #10
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,697

Original Poster
Rep: Reputation: 48
OK, so the NETWORK= really I just figure out by using the IP address and the netmask values, right?
 
Old 01-31-2014, 07:00 PM   #11
myatthu
Member
 
Registered: Jan 2014
Distribution: CentOS, Fedora, Ubuntu
Posts: 108

Rep: Reputation: 18
Yes. What you configure and routing table is result is correct
 
Old 02-03-2014, 03:32 PM   #12
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,697

Original Poster
Rep: Reputation: 48
What I still don't understand exactly is, how do I figure out that with an IPADDR=1.2.2.80 and NETMASK=255.255.255.192, that that equals a NETWORK=1.2.2.64? Like if someone gave me an IP and netmask, how do you go about figuring out network?
 
Old 02-03-2014, 06:30 PM   #13
myatthu
Member
 
Registered: Jan 2014
Distribution: CentOS, Fedora, Ubuntu
Posts: 108

Rep: Reputation: 18
You can simply study the CIDR subnet calculation for further understanding.
The other way is use ip subnet calculator.
 
Old 02-04-2014, 07:39 AM   #14
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,697

Original Poster
Rep: Reputation: 48
I used an online calculator, thanks.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
PPTP with Centos Server & Win 7 client not providing default gateway cerien Linux - Networking 8 08-26-2013 10:20 AM
Timestamps, VSFTP, Samba & files edited on a server dsackett Linux - Newbie 3 11-24-2008 02:10 PM
add sunnet mask & default gateway Dawar Linux - Networking 3 01-25-2007 09:36 PM
Get the default gateway / net mask idit Linux - Networking 1 11-21-2004 09:39 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:56 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration