I have downloaded ubuntu on virtualbox , and I installed apache2 on it ,i did configured the server and it works on "localhost" ,the problem is that i need the ip address of the server ,the command 'ifconfig' gives private ip address , how can I find the local ip for the server ?
please help me :( !!
22 Answers
You get you local IP of the currently used network card (the one used inside your local LAN network, assigned by your router) using the following command:
ip route get 1 | awk '{print $NF; exit}'This command prints both IPv4 and IPv6 address of the currently active interface:
hostname -IIf you prefer a simple command, but are ok with reading through a bit of text to locate the information, check out one of the commands below. They print all available network interfaces by default, but you can also specify one by adding its name as additional argument to each of them.
ifconfig
ip addr showYou get your public IP (the one with which you're connected to the internet) using the command:
curl ifconfig.meOr visit the site in your browser to see your IP address and further information, and to learn more command-line options.
2If you would like to access your APACHE from your local network (from network the machine running virtualbox is connected to) you can set the network configuration of the virtual instance to 'Bridged Adapter'. Doing this, your virtual machine will use the selected physical network card of your host. Having this in place the virtual instance can easily get an IP from your router via DHCP. And then you can look-up the address assignment in the virtual machine or in the lease list on the router.