How to undefine CONFIG_CMD_NET?

I can not find this configuration defined anywhere in my include/configs/.h file and includes, nor in configs/_defconfig and it is still defined in .config file after configuring u-boot. I am seeing this configuration defined in tools/Makefile. Is it default? Should I use #undef in me include/configs/.h or CONFIG_CMD_NET=n in configs/_defconfig? What is better?

Which module and BSP version are you using?

Assuming U-Boot v2016.11, this symbol is defined in cmd/Kconfig and is therefore should be defined or disabled in Kconfig. Now in Kconfig language, every configuration has a default (in this case default y). All defconfigs are minimal configs in the sense of they only contain deviations from what is the Kconfig default. This is why you don’t see CONFIG_CMD_NET in defconfigs. To disable a config symbol which is by default yes, you need to add a line like this:

# CONFIG_CMD_NET is not set

The automated way to create a new defconfig is to use the build system:

make your_defconfig
make nconfig # (de)selcet the configurations you wish to use
make savedefconfig

With that you should end up with a new defconfig.