Giter VIP home page Giter VIP logo

c2-ec2-netutils's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

c2-ec2-netutils's Issues

Behavior change in grep 3.8 causes netutils scripts to malfunction

Behavior change in grep 3.8 causes netutils scripts to malfunction

In version 3.8 grep was migrated to PCRE2 according to this commit:
e0d39a9133e1507345d73ac5aff85f037f39aa54 https://git.savannah.gnu.org/cgit/grep.git/

In pcre2 any alpha-numeric character preceded by a backslash is treated as a character or sequence with a special meaning. In the case where the sequence has not been defined to be special, an error occurs. This seems to be different from pcre, where the error does not occur and the backslash is ignored.

This behavior change affects some grep -P commands in netutils scripts and even in dpkg scripts.
Examples are:

grep returns the following error:

# grep -P '^\ID=' /etc/os-release
grep: unrecognized character follows \

It looks like the backslash in this case were not needed and now it even causes an error.

grep version: grep (GNU grep) 3.8 on Ubuntu 23.04 (Lunar Lobster)

Route policy rules are not added on boot in debian-like distros

Route policy rules are not added on boot in debian-like distros.

Having route policy rules configured is vital for instances with multiple network interfaces, because rules specify which routing table will be used for sending response traffic based on dst ip of incoming traffic. If route policy rules are not configured, traffic coming to all interfaces is being sent through the primary interface according to default route in main table, and this leads to a lack of connectivity.

Expected behavior:
Route policy rules for non-primary interfaces are being added on boot.

Actual behavior:
Route policy rules are not added.

This behavior is caused by udev rule running script for adding route policy rules before the primary interface is configured. Primary interface should be configured before the script runs, because script relies on EC2 metadata, which is not available unless primary interface is up.

`NetworkManager` with `ifcfg-rh` doesn't like routes with specified `proto`

On systems with the initscripts package controlling the network, such as RHEL 7, it was normal to use proto kernel in routes in the configurations /etc/sysconfig/network-scripts/route-*, because they were used literally by network initscript. On systems with NetworkManager, these configurations are interpreted by the ifcfg-rh plugin, and it seems to not allow specificproto and instead prefers nothing (which means the static proto will be used).

c2-ec2-netutils for rhel generate route configs with routes with proto kernel in them.

cat <<- EOF > ${route_file}
default via ${gateway} dev ${INTERFACE} table ${RTABLE}
${cidr} dev ${INTERFACE} proto kernel scope link src ${primary_ipv4} table ${RTABLE}
EOF

This causes a warning on RHEL8-9:

NetworkManager[756]: <warn>  [1685325176.7685] ifcfg-rh:     ignoring invalid route at "        10.222.16.0/20 dev eth1 proto kernel scope link src 10.222.16.4 table 10001" (/etc/sysconfig/network-scripts/route-eth1:2): Unrecognized argument ("to" is duplicate or "proto" is garbage)

And routes are applied with proto static:

~# ip r s t 10001
default via 10.222.16.1 dev eth1 proto static metric 104 
10.222.16.1 dev eth1 proto static scope link metric 104 
~#

On Fedora 38 (aka RHEL 10) this causes the same warning:

NetworkManager[541]: <warn>  [1685325497.1294] ifcfg-rh:     ignoring invalid route at "        10.222.16.0/20 dev eth1 proto kernel scope link src 10.222.16.4 table 10001" (/etc/sysconfig/network-scripts/route-eth1:2): Unrecognized argument ("to" is duplicate or "proto" is garbage)

But the routes are not applied at all:

~# ip r s t 10001
default via 10.222.16.1 dev eth1 proto static metric 104 
~#

Route tables for non-primary interfaces are not added on Debian 11

Route tables for non-primary interfaces are not added on Debian 11

In PR #1 support for Debian 11 were introduced.
Everything works like on previous Debian versions, except for one thing -- script fails to add different route table numbers in different interface configs for network scripts.

Expected behavior:
Scripts generate configs for interfaces and use different route table numbers for interface specific routes.

Actual behaviour:
Scripts generate configs for interfaces and use the same route table with number 10000

This behavior is caused by a bug in the following if

# define a config file and generate a routing table number
if [ ${release} == "ubuntu" ]; then
config_file="/etc/netplan/config-${INTERFACE}.yaml"
RTABLE=${INTERFACE#ens}
else
config_file="/etc/network/interfaces.d/config-${INTERFACE}.cfg"
RTABLE=${INTERFACE#eth}
fi

It ensures that a unique route table number is used based on the interface name.
Since Debian 11 uses the ens* interface naming, this code does not generate a routing table number.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.