linux command which shows physical IP of system - linux

Is there any command which determine physical IP of the system ( on each physical Interface)?
Actually I want to make a script which un plump all IP except physical IP.
Thanks in advance,
Deepak

There will be one IP address for a server, since it is an entity in network for that server. To get the IP adrress in linux:
hostname -i

...on each physical Interface...
That would be ifconfig.
You can also call hostname -I (note the uppercase "I"), which lists all configured IP's except loopback and IPv6 link-local.

Related

Is the IP address resolution wrong in my EC2 instance?

Hi,
The following is the result of netstat -a -o -n on my windows ec2 instance.
I see that port 80 is being used by different processes in both physical and foreign address. Does this mean that the NAT is not resolving the private and public IP address of the EC2 instance properly ?
What should I do to fix it ? On the private IP, port 80 is occupied by the node server while a chrome transaction is occupying port 80 on the foreign address.
Thanks.
Try setting DHCP Option set.
I had a problem with it. Windows Domains Machines were not resolved. At Windows networks, with AD, you must fill your domain at DHCP Option.
Look at http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_DHCP_Options.html

Identify different hosts which are the same environment login by ssh

I ssh another host, i know i can ifconfig to realize not the localhost. I want a simple and clear way. Such as change the color of PS1 or something else. It's the remote server.
and now it's my local server.
Is there anyideas?
Theoritically you can make two pcs exactly same in environment. They can have same hostname, OS, applications etc. So the only way to differentiate two PCs on a network is by IP address.
To assign IP address, DHCP protocol uses MAC address which as supposed to be globally unique. So to be completely sure, you have to check IP address or MAC address to differentiate between PCs.
But practically, checking hostname will also work.
~$ hostname
ubuntu-laptop

linux ifconfig doesn't return an IP address

I want to know the IP adress of my linux (virtual machine)
but when i enter ifconfig it doesn't return an IP adress.
Normally it should be between "link encap" and "up broadcast" but it's not..
where to look?
Does your VM have internet connection? It seems to me that it doesn't have the interface configured.
Quick try, write in a shell "dhclient eth0".
If it still doesn't have IP, post the output of ifconfig.

Troubles accessing the VirtualHost on a local net

Hi I have a Huawei ADSL modem with a dynamic IP. I set up a dynamic dns with freedns and I can easily access my Virtual host on apache from outside my private network, from internet.
So trying to access it from a local network I get a modems login page.
I have the rule in my modems NAT to connect port 80 to my server but it seems it doesnt work from internal net.
My server hosting the virtual host is 192.168.0.1 , the modem has the 192.168.0.254 address.
I tried to put my external domain name into the /etc/hosts file, but if I do that then asterisk server gets confused.
What could be the cause of the problem ? And what would be the best solution to this problem ?
Should I set up a caching DNS on the private side of the net ?
Hugger is half right... Its because your router is blocking loopbacks. The easiest way around this is to edit the hosts file (See the Wiki page) on the computer that is behind the network to see the local IP of the computer as the virtual host your going for. For example if your server is on 192.168.0.1 and the virtual hostname is www.imrad.com then insert
192.168.0.1 www.imrad.com
into your hosts file. If your computer leaves the local network (like a laptop you take to work) and joins a network not behind your router you need to comment out the line in the hosts file.
well actually to access that you must find the local ip address of the server by going into command line/prompt and typing ipconfig /all then you will find ipv4 address. Take note of that.
Go to another computer and your that ip and it will show.
The reason that was happening is because the router/modem knows you are in its network so it will think you ar trying to go top the login page of it. That happens to me too.

Linux hostname resolution on a machine with multiple running interfaces

I have 4 running eth ports on my Linux machine (eth0 through eth3). So if i give the command host <hostname>, which eth port's ipaddress will be returned? how does linux decide which eth port's ip address to be returned?
Thanks,
LinuxPenseur
host does not look at your local IPs, it looks up the hostname based on the rules specified in /etc/nsswitch.conf
In nsswitch.conf you will typically have this entry:
hosts: files dns
This means that the resolver will first check /etc/hosts, if it cannot find anything there it'll check /etc/resolv.conf and ask the specified DNS servers for the IP, optionally appending the "search" and "domain" suffixes specified in resolv.conf
See http://www.faqs.org/docs/linux_network/x-087-2-resolv.library.html
What's your "primary" interface? That one is used.
http://ubuntuforums.org/archive/index.php/t-1120370.html

Resources