ipadm to set ip address of an interfce as 0.0.0.0 - solaris

Is there any command or option in ipadm command to set the ip addres as 0.0.0.0
in solaris 11.
when I tried to create ip address using the command ipadm, getting the below error.
ipadm create-addr -T static -a 0.0.0.0/0 net0/v4
ipadm: cannot create address: Invalid address

The address 0.0.0.0 is an IPv4 reserved address, so you may not assign it to an interface. Please see https://en.wikipedia.org/wiki/Reserved_IP_addresses#Reserved_IPv4_addresses as well as https://stackoverflow.com/a/3655736/2299087 for more details.
Why do you want to create an interface with this address, anyway?

Related

Not able add extra IP to vps server in OVH

I am trying to add extra IP to my OVH vps server by following there guide but getting this error.
I am using cent os 6 - 64bit using this guide to add IP to my vps server
https://docs.ovh.com/gb/en/dedicated/network-ipaliasing/
"# ifup eth0:0
ipcalc: bad netmask: 255.255.255.255
ipcalc: bad netmask: 255.255.255.255
is already in use for device eth0...79
/".or: an inet prefix is expected rather than "54.xx.xx.xxx
.for eth0:0g address 54.xx.xx.xxx
bind: Cannot assign requested address"
Where am I wrong? Please help
Is it a dedicated server or VPS? Ask the OVH support if they allow additional IP on a VPS
Try using Prefix instead of NETMASK

Add Additional Ips to my new Dedicated Server

I'am not really into Commands and Dedciated server but i had to buy one recently with 5 usuable Ips and got the informations Bellow :
Usable IP Range: 142.54.190.234 - 142.54.190.238
Gateway: 142.54.190.233
Subnet Mask:255.255.255.248
How can add those Ips to the Main one via SSH ?? since i can connect to only the first one which is 142.54.190.234 knowing that im planing to Install Powermta on that server Btw the machine is runing centos 6
Assuming your default interface is eth0 then you'll be able to add the other ip address as aliases to the default interface (eth0) or whatever interface name you have there.
ifconfig eth0:0 142.54.190.235 netmask 255.255.255.248
ifconfig eth0:1 142.54.190.236 netmask 255.255.255.248
ifconfig eth0:2 142.54.190.237 netmask 255.255.255.248
ifconfig eth0:3 142.54.190.238 netmask 255.255.255.248
If you can add these in /etc/rc.local at the end just to be sure that in case of a restart/reboot of the server, these ips are added after boot.
There are other methods as well but this would be the easiest one and it does exactly what you need.

mongodb listen to localhost and lan ip only

I have an Ubuntu server with mongodb installed. Is it possible to configure mongodb in such a way that I can connect to it using only localhost and its LAN IP address.
The default mongo configuration works fine for connecting using localhost:
bind_ip = 127.0.0.1
If I change to the LAN IP, then I am only able to connect using that IP, and not using localhost:
bind_ip = 10.10.10.10
If I try to add both, then I get an address in use error and doesn't start:
bind_ip = 127.0.0.1, 10.10.10.10
If I remove the bind_ip setting, then both work, but I am also able to connect with the servers external IP (which I do not want).
#bind_ip = 127.0.0.1, 10.10.10.10
So, how can I tell mongo to listen on the local interface, but allow connections from both localhost and its LAN IP?
With the help of #wdberkeley's comment, I realized that the problem was the space after the , in the list of IP addresses the bind to. However, it seems that this issue only affects the old config file format (not YAML).
# This Works:
bind_ip = 127.0.0.1,10.10.10.10
# This doesn't work:
bind_ip = 127.0.0.1, 10.10.10.10
Bind to address 0.0.0.0 this will allow it to answer regardless of the IP address being used and even on machines that have multiple network cards with different IP addresses

How does the OS know which network interface to use for the internet?

I have a PC with two network interfaces: eth0 and eth1.
eth0 - Has an ip of 192.168.11.X/24.
eth1 - Has an ip of 192.168.130.X/24. eth1 has internet connectivity.
How does my OS know which interface to use when I try connecting to the internet? Does it iterate over all default gateways? Does it have any cache of what each interface provides? Is there any difference in the behaivior between Windows and Linux?
I'm going to answer for the Linux side of the house (at least for Debian-based systems, such as Ubuntu, since it's more common for users at this point):
Type the following into a command line:
route -n
You should see your "routing table" appear, with something like the following:
Destination Gateway Genmask ... Iface
0.0.0.0 192.168.11.254 0.0.0.0 ... eth0
169.254.0.0 0.0.0.0 255.255.0.0 ... eth0
192.168.11.0 0.0.0.0 255.255.255.0 ... eth0
192.168.130.0 0.0.0.0 255.255.255.0 ... eth1
I omitted a couple columns, but basically, the line that says "0.0.0.0" under "Destination" is the line that determines where your default route is. In other words, where all of the traffic goes that isn't destined for any of the other subnets in the other lines (google.com, facebook.com, whatever).
If it's not right (such as in the above table, where "eth1" is the card you want with Internet access), you should change the default route:
sudo route del default
sudo route add default gw 192.168.130.254 netmask 255.255.255.0
That will fix it for now. To make it permanent, edit your interfaces file:
sudo gedit /etc/network/interfaces
Edit it to look something like the following (change as necessary to your specific situation):
auto eth0
iface eth0 inet dhcp
up route del default
auto eth1
iface eth1 inet dhcp
up route add default gw 192.168.130.254 netmask 255.255.255.0
Then restart networking to see if that did the trick:
sudo /etc/init.d/networking restart
The feature you're asking about is a routing table, a list of destinations known to the host.
When the OS needs to forward a packet it checks this list and chooses the most appropriate one (from specific destinations to general ones). For example:
192.0.2.0/28 - 192.0.2.1 via eth1
198.51.100.0/27 - 198.51.100.1 via eth0
0.0.0.0/0 - 203.0.113.1 via eth0
Note the last destination: it will match any IPv4 address.

Changing IP address via command line on Windows XP

I'm trying to change a machine IP address via cmd.exe with this code:
netsh int ip set address name="Local Area Connection" source=static addr=???.???.???.??? mask=255.255.255.0
The problem that the IP doesn't change (checked by ipconfig) but doesn't not changed on the DHCP. Thus when I restart the machine, the IP is returned to DHCP.
I need a way to change the IP permanently via command line.
Any ideas?
You can use the command below:
netsh interface ip set address name="Local Area Connection" static 192.168.0.100 255.255.255.0 192.168.0.1 1
where
the 192.168.0.100 is the IP address
the netmask is 255.255.255.0
and the gateway is 192.168.0.1
You can also have the DNS configured automatically by DHCP using following command:
netsh interface ip set dns "Local Area Connection" dhcp
If you are looking for change it regularly here is a trick :)
netsh interface ip set address name="Wi-Fi" static 192.168.1.140 255.255.255.0 192.168.1.1 // this change IP
netsh interface ip add dns name="Wi-Fi" 8.8.8.8 index=2 //this change DNS
pause
type above in notepad and save as ip.bat.
run the file as administrator