How to know the network name
Jerry Geis
jerry.geis at gmail.com
Sat Oct 23 19:51:05 UTC 2021
On Sat, Oct 23, 2021 at 2:38 PM Little Girl <littlergirl at gmail.com> wrote:
> Hey there,
>
> Jerry Geis wrote:
>
> >I need to know the correct ens4 type network name so when the
> >machine reboots and tries to install Ubuntu 20.04 with a static
> >address - all is correct. How do I get that name?
>
> This command will give it to you, although it's at least a little bit
> clumsy and could be done more elegantly:
>
> ip address | grep "BROADCAST" | cut -d' ' -f2 | cut -d':' -f1
>
> How the command works:
> * The ip address command gets your network
> configuration and passes it to the grep command.
> * The grep command searches for BROADCAST and finds a line of
> content containing the search term. It passes its findings
> to the first cut command.
> * The first cut command removes all but the second field,
> which is your iface plus a colon after it. It passes its
> result to the next cut command.
> * The next cut command removes all but the first field, so it
> removes the colon and leaves you with your iface.
>
> Those last two cuts are the clumsy part that someone more well-versed
> in Bash could probably rewrite into one step.
>
> --
> Little Girl
>
> There is no spoon.
>
> --
> ubuntu-users mailing list
> ubuntu-users at lists.ubuntu.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
This is useful "after" ubuntu is installed... I am "converting" a centOS
machine with network names like eth0 and eth1 - which is what your command
prints to the screen.
I need to know a command I can run on CentOS that will tell me what the
ubuntu netowrk name will be bill. like in this case I did manually eth0
gets renamed to ens3 or eth1 gets renames to ens4.
I need to build that Ubuntu grub kernel install line with the correct
network name so when I reboot from centos into ubuntu - hte correct network
name is given.
Thanks,
Jerry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20211023/ff7758bb/attachment.html>
More information about the ubuntu-users
mailing list