LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 05-13-2009, 09:56 AM   #1
KFC123
Member
 
Registered: May 2009
Posts: 47

Rep: Reputation: 15
what does the following command means?


A IT admin ask me to run the following command on the server so he can access that computer remotely with ssh

ifconfig eth0 1.2.3.5 netmask 255.255.255.0 up; route add default gw 1.2.3.1

But how does this work? What is ip 1.2.3.5? Can he access my computer at 1.2.3.5 (there is a static ip for the server, which might be used internally)?
 
Old 05-13-2009, 10:27 AM   #2
Robhogg
Member
 
Registered: Sep 2004
Location: Old York, North Yorks.
Distribution: Debian 7 (mainly)
Posts: 653

Rep: Reputation: 97
1.2.3.5 is simply a perfectly valid IP address - nothing special about it that I am aware of. However, it might be that access control lists on your LAN are set up so that SSH would be allowed for that address, but blocked for your server's usual IP address.
 
Old 05-13-2009, 10:28 AM   #3
rayfordj
Member
 
Registered: Feb 2008
Location: Texas
Distribution: Fedora, RHEL, CentOS
Posts: 488

Rep: Reputation: 78
it is two commands:
1) ifconfig eth0 1.2.3.5 netmask 255.255.255.0 up
2) route add default gw 1.2.3.1

1) configures your system's interface eth0 with the ip 1.2.3.5/255.255.255.0
2) configures the default gw to use for routing outside of 1.2.3/24 network

IP 1.2.3.5 is the IP you assigned to your system's eth0 interface
Yes, access to your computer via 1.2.3.5 on the network is possible as long as firewall ports are open and service is listening and remote user/system can route to that IP and know a valid user/pass.
 
Old 05-13-2009, 10:56 AM   #4
KFC123
Member
 
Registered: May 2009
Posts: 47

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Robhogg View Post
1.2.3.5 is simply a perfectly valid IP address - nothing special about it that I am aware of. However, it might be that access control lists on your LAN are set up so that SSH would be allowed for that address, but blocked for your server's usual IP address.
Well, if I change 1.2.3.5 to the static ip, it works and I can acces it via ssh from other place. But it seems fail for 1.2.3.5. Is it possible to have two ip binding to eth0?
 
Old 05-13-2009, 01:10 PM   #5
Robhogg
Member
 
Registered: Sep 2004
Location: Old York, North Yorks.
Distribution: Debian 7 (mainly)
Posts: 653

Rep: Reputation: 97
Quote:
Originally Posted by KFC123 View Post
But it seems fail for 1.2.3.5. Is it possible to have two ip binding to eth0?
What is it that is failing with 1.2.3.5?

Anyway, yes, it should be possible to define a sub-interface, e.g.:
Code:
ifconfig eth0:1 1.2.3.5 netmask 255.255.255.0
There may be a problem with the routing rule - if you defined 1.2.3.1 as the default gateway, then the internet would no longer be reachable via your other ip address. You'd probably have to add a specific static route for the computer / network from which SSH access is needed, e.g.
Code:
route add -net 80.254.3.24 netmask 255.255.255.248 gw 1.2.3.1
... would add a route to the network 80.254.3.24/29 (address and mask picked at random), via 1.2.3.1. The machine should choose the most specific route when making routing decisions (so should route all traffic to that address range via 1.2.3.1, but all other traffic should still go via the default gateway).

Hope this helps,
Rob
 
  


Reply



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
What a command means... shorte85 Linux - Newbie 7 03-13-2009 10:16 PM
What is this value means for??? marhen Programming 4 05-14-2008 05:58 AM
What does it means? lavluda Debian 5 03-01-2006 08:28 AM
Command line option -F means what? TSynergy Linux - Newbie 5 11-15-2005 08:01 PM
What the T means? dominant Linux - Newbie 1 06-21-2004 06:07 AM

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

All times are GMT -5. The time now is 09:04 AM.

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