Have a static IP for net0

Hi,
Here is what I get within Solaris.

huamin@SOL11I:~$ ifconfig -a
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
	inet 127.0.0.1 netmask ff000000 
net0: flags=1004843<UP,BROADCAST,RUNNING,MULTICAST,DHCP,IPv4> mtu 1500 index 2
	inet 0.0.0.0 netmask ff000000 
net1: flags=1004843<UP,BROADCAST,RUNNING,MULTICAST,DHCP,IPv4> mtu 1500 index 3
	inet ?.?.240.138 netmask fffff000 broadcast ?.?.255.255
lo0: flags=2002000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv6,VIRTUAL> mtu 8252 index 1
	inet6 ::1/128 
net0: flags=20002004841<UP,RUNNING,MULTICAST,DHCP,IPv6> mtu 1500 index 2
	inet6 fe80::a00:27ff:fe04:7c5e/10 
net1: flags=20002004841<UP,RUNNING,MULTICAST,DHCP,IPv6> mtu 1500 index 3
	inet6 fe80::a00:27ff:fead:2a7/10 
huamin@SOL11I:~$ 

How to set up one static IP, like 192.168.168.20 for net0 of Solaris?

Many Thanks & Best Regards,
HuaMin

Post output of:

ipadm
netadm list

Fyi

 huamin@SOL11I:~$ ipadm
NAME              CLASS/TYPE STATE        UNDER      ADDR
lo0               loopback   ok           --         --
   lo0/v4         static     ok           --         127.0.0.1/8
   lo0/v6         static     ok           --         ::1/128
net0              ip         ok           --         --
   net0/v4        dhcp       ok           --         ?
   net0/v6        addrconf   ok           --         fe80::a00:27ff:fe04:7c5e/10
net1              ip         ok           --         --
   net1/v4        dhcp       ok           --         ?.?.254.65/20
   net1/v6        addrconf   ok           --         fe80::a00:27ff:fead:2a7/10
huamin@SOL11I:~$ netadm list
TYPE        PROFILE        STATE
ncp         Automatic      online
ncu:phys    net0           online
ncu:phys    net1           online
ncu:ip      net0           offline*
ncu:ip      net1           online
ncp         DefaultFixed   disabled
loc         Automatic      online
loc         NoNet          offline
huamin@SOL11I:~$ 

Many Thanks & Best Regards,
HuaMin

Please use code tags when posting output of the commands. To set static IP address on net0, try this:

netadm enable -p ncp defaultfixed
ipadm delete-ip net0
ipadm create-ip net0
ipadm create-addr -T static -a local=192.168.168.20/24 net0/v4
1 Like

Sorry. Here is what I've got

huamin@SOL11I:~$ netadm enable -p ncp defaultfixed
Enabling ncp 'DefaultFixed'
huamin@SOL11I:~$ ipadm delete-ip net0
ipadm: cannot delete interface net0: No such interface
huamin@SOL11I:~$ ipadm create-ip net0
ipadm: cannot create interface net0: Permission denied
huamin@SOL11I:~$ ipadm create-addr -T static -a local=192.168.168.20/24 net0/v4
ipadm: cannot create address: No such interface
huamin@SOL11I:~$ ifconfig -a
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
    inet 127.0.0.1 netmask ff000000 
lo0: flags=2002000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv6,VIRTUAL> mtu 8252 index 1
    inet6 ::1/128 
huamin@SOL11I:~$ 

Many Thanks & Best Regards,
HuaMin

You should perform all of those operations as root.

Thanks. Here are what I've got (after I've "su" to root)

root@SOL11I:/home/huamin# netadm enable -p ncp defaultfixed
Enabling ncp 'DefaultFixed'
root@SOL11I:/home/huamin# ipadm delete-ip net0
ipadm: cannot delete interface net0: No such interface
root@SOL11I:/home/huamin# ipadm create-ip net0
root@SOL11I:/home/huamin# ipadm create-addr -T static -a local=192.168.168.20/24 net0/v4
root@SOL11I:/home/huamin# ifconfig -a
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
    inet 127.0.0.1 netmask ff000000 
net0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 4
    inet 192.168.168.20 netmask ffffff00 broadcast 192.168.168.255
    ether 8:0:27:4:7c:5e 
lo0: flags=2002000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv6,VIRTUAL> mtu 8252 index 1
    inet6 ::1/128 
net0: flags=20002000840<RUNNING,MULTICAST,IPv6> mtu 1500 index 4
    inet6 ::/0 
    ether 8:0:27:4:7c:5e 
root@SOL11I:/home/huamin# 

why can't I go to Internet now?
Many Thanks & Best Regards,
HuaMin

Precisely because you replaced the automatic network configuration done by DHCP by a fixed address one.

It would have been wiser to stay DHCP and configure your DHCP server to provide a fixed IP adress to your mac address, if it supports that setting.

Alternatively, you have to manually configure the DNS and default router.

In Redhat, we can have 2 IPs like

eth0 > fixed to be 192.168.168.20
eth1 > IP allocated by the ISP

why can't we achieve the same in Solaris 11?

Many Thanks & Best Regards,
HuaMin

eth0 and eth1 are two different NICs on Linux. Perhaps do you mean eth0 and eth0:1 ?

I think he means net0 and net1 on his installation. And yes, you can have one interface configured with static IP and one with DHCP:

ipadm create-addr -T static -a local=192.168.168.20/24 net0/v4
ipadm create-addr -T dhcp net1/v4

Thanks to all.
Bartus,
Can you please help to these I've got?

root@SOL11I:/home/huamin# netadm enable -p ncp defaultfixed
ncp 'DefaultFixed' is already enabled
root@SOL11I:/home/huamin# ipadm delete-ip net0
ipadm: cannot delete interface net0: No such interface
root@SOL11I:/home/huamin# ipadm create-addr -T static -a local=192.168.168.20/24 net0/v4
ipadm: cannot create address: No such interface
root@SOL11I:/home/huamin# 

Many Thanks & Best Regards,
HuaMin

You are missing the step that creates the net0 interface

ipadm create-ip net0

Can you please advise to these 2 errors I've got below?

root@SOL11I:/home/huamin# ipadm delete-ip net0
ipadm: cannot delete interface net0: No such interface
root@SOL11I:/home/huamin# ipadm create-ip net0
ipadm create-ip net0
root@SOL11I:/home/huamin# ipadm create-ip net0
ipadm: cannot create interface net0: Interface already exists
root@SOL11I:/home/huamin# 

Many Thanks & Best Regards,
HuaMin

Well you cannot delete an interface that doesn't exist and you cannot create an interface that already exists, quite a logical behavior.

It would help if you follow precisely the steps that have been suggested.

2 Likes

Where are the steps in details? I did each action one by one. How to correct the steps I've performed there? Thanks.

See post #4

I'm afraid no. Double check what you did.

1 Like

Hi,
Four days ago, I got these steps from Bartus

netadm enable -p ncp defaultfixed
ipadm delete-ip net0
ipadm create-ip net0
ipadm create-addr -T static -a local=192.168.168.20/24 net0/v4

I've already "su" to root and can get these below

root@SOL11I:/home/huamin# ifconfig -a
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
    inet 127.0.0.1 netmask ff000000 
net0: flags=1004843<UP,BROADCAST,RUNNING,MULTICAST,DHCP,IPv4> mtu 1500 index 2
    inet 0.0.0.0 netmask ff000000 
    ether 8:0:27:4:7c:5e 
net1: flags=1004843<UP,BROADCAST,RUNNING,MULTICAST,DHCP,IPv4> mtu 1500 index 3
    inet ?.?.241.112 netmask fffff000 broadcast ?.?.255.255
    ether 8:0:27:ad:2:a7 
lo0: flags=2002000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv6,VIRTUAL> mtu 8252 index 1
    inet6 ::1/128 
net0: flags=20002004841<UP,RUNNING,MULTICAST,DHCP,IPv6> mtu 1500 index 2
    inet6 fe80::a00:27ff:fe04:7c5e/10 
    ether 8:0:27:4:7c:5e 
net1: flags=20002004841<UP,RUNNING,MULTICAST,DHCP,IPv6> mtu 1500 index 3
    inet6 fe80::a00:27ff:fead:2a7/10 
    ether 8:0:27:ad:2:a7 

Here I follow the steps from Bartus.

root@SOL11I:/home/huamin# netadm enable -p ncp defaultfixed
Enabling ncp 'DefaultFixed'

Can you please advise why I cannot delete net0 below?

root@SOL11I:/home/huamin# ipadm delete-ip net0
ipadm: cannot delete interface net0: No such interface
root@SOL11I:/home/huamin# 

Many Thanks & Best Regards,
HuaMin

That's because it's not created via create-ip command :rolleyes:

Why don't you read about it a bit under manual configuration in article below :
How to Get Started Configuring Your Network in Oracle Solaris 11

1 Like

Exactly as Peasant said.
Probably you have delete it meanwhile and did not create again.
Use command

# ipadm

or

# dladm

to see current status of all your interfaces.
And make some exercises with this command with different arguments. You can always use man pages for those commands.

# man ipadm