LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Containers
User Name
Password
Linux - Containers This forum is for the discussion of all topics relating to Linux containers. Docker, LXC, LXD, runC, containerd, CoreOS, Kubernetes, Mesos, rkt, and all other Linux container platforms are welcome.

Notices


Reply
  Search this Thread
Old 09-13-2018, 03:46 AM   #1
gnourt
LQ Newbie
 
Registered: Mar 2018
Posts: 12

Rep: Reputation: Disabled
can't set the IP of veth0


I am trying to set IP for virtual Ethernet devices as below:

root@vxq:~# ip netn add net_ns0
root@vxq:~# ip netns exec net_ns0 ip link add veth0 type veth peer name veth1
root@vxq:~# ip netns exec net_ns0 ifconfig veth0 192.168.0.2/24
ifconfig: bad address '192.168.0.2/24'
root@vxq:~#

It appeared an error "bad address".
But I replaced "192.168.0.2/24" by "192.168.0.2 netmask 255.255.255.0". It was ok.

I think they're the same meaning.
I don't know why? Could you please explain me about this issue?
 
Old 09-13-2018, 04:29 AM   #2
berndbausch
Senior Member
 
Registered: Nov 2013
Location: Tokyo
Distribution: Redhat/Centos, Ubuntu, Raspbian, Fedora
Posts: 1,758

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
I am not sure, but I guess that ifconfig simply doesn’t support the CIDR format.

Since you use ip otherwise, why not for setting the address? For example:

Code:
ip a add 192.168.0.2/24 dev veth0
 
1 members found this post helpful.
Old 09-13-2018, 06:19 AM   #3
gnourt
LQ Newbie
 
Registered: Mar 2018
Posts: 12

Original Poster
Rep: Reputation: Disabled
Thank you for your answer!
Do you know how to check the ifconfig support CIDR format or not?
 
Old 09-13-2018, 02:03 PM   #4
berndbausch
Senior Member
 
Registered: Nov 2013
Location: Tokyo
Distribution: Redhat/Centos, Ubuntu, Raspbian, Fedora
Posts: 1,758

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
Quote:
Originally Posted by gnourt View Post
Do you know how to check the ifconfig support CIDR format or not?
The man page states:
Synopsis
ifconfig [interface]
ifconfig interface [aftype] options | address ...
(...)
address
The IP address to be assigned to this interface.
It says IP address, not CIDR.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Awk - Process a set of records if field $5 of line 01 is 'W', otherwise copy set to o High-T Linux - Newbie 6 02-06-2015 10:14 AM
run set-uid shell program in ubuntu and set premission 4755 goldengriff Ubuntu 12 11-20-2013 02:51 AM
hi i have installed ns2 in linux but unable to set the path please tell me how to set chandu1234 Linux - Software 2 08-29-2013 04:58 PM
set linux hostname & question about set multiple domain on one ip l0pht Linux - Networking 4 06-08-2012 10:14 AM
How do I set a real system user in ProFTP to set to a specific directory? j.smith1981 Linux - Server 27 12-14-2010 08:32 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Containers

All times are GMT -5. The time now is 08:50 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration